Resguardo inicial

This commit is contained in:
lastdragon
2026-09-06 12:53:21 -06:00
parent 662efe3c2a
commit ad2088d178
94853 changed files with 43200404 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
#
# Arch-specific network modules
#
obj-$(CONFIG_BPF_JIT) += bpf_jit_comp.o bpf_timed_may_goto.o
obj-$(CONFIG_HAVE_PNETID) += pnet.o
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,45 @@
/* SPDX-License-Identifier: GPL-2.0 */
#include <linux/export.h>
#include <linux/linkage.h>
#include <asm/asm-offsets.h>
#include <asm/nospec-insn.h>
#define R2_OFF 0
#define R5_OFF (R2_OFF + (5 - 2 + 1) * 8)
#define R14_OFF (R5_OFF + 8)
#define RETADDR_OFF (R14_OFF + 8)
#define R15_OFF (RETADDR_OFF + 8)
#define BACKCHAIN_OFF (R15_OFF + 8)
#define FRAME_SIZE (BACKCHAIN_OFF + 8)
#define FRAME_OFF (STACK_FRAME_OVERHEAD - FRAME_SIZE)
#if (FRAME_OFF + BACKCHAIN_OFF) != __SF_BACKCHAIN
#error Stack frame layout calculation is broken
#endif
GEN_BR_THUNK %r1
SYM_FUNC_START(arch_bpf_timed_may_goto)
/*
* This function has a special ABI: the parameters are in %r12 and
* %r13; the return value is in %r12; all GPRs except %r0, %r1, and
* %r12 are callee-saved; and the return address is in %r0.
*/
stmg %r2,%r5,FRAME_OFF+R2_OFF(%r15)
stg %r14,FRAME_OFF+R14_OFF(%r15)
stg %r0,FRAME_OFF+RETADDR_OFF(%r15)
stg %r15,FRAME_OFF+R15_OFF(%r15)
lgr %r1,%r15
lay %r15,-FRAME_SIZE(%r15)
stg %r1,__SF_BACKCHAIN(%r15)
lay %r2,0(%r12,%r13)
brasl %r14,bpf_check_timed_may_goto
lgr %r12,%r2
lg %r15,FRAME_SIZE+FRAME_OFF+R15_OFF(%r15)
lmg %r2,%r5,FRAME_OFF+R2_OFF(%r15)
lg %r14,FRAME_OFF+R14_OFF(%r15)
lg %r1,FRAME_OFF+RETADDR_OFF(%r15)
BR_EX %r1
SYM_FUNC_END(arch_bpf_timed_may_goto)
+92
View File
@@ -0,0 +1,92 @@
// SPDX-License-Identifier: GPL-2.0
/*
* IBM System z PNET ID Support
*
* Copyright IBM Corp. 2018
*/
#include <linux/device.h>
#include <linux/export.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/types.h>
#include <asm/ccwgroup.h>
#include <asm/ccwdev.h>
#include <asm/pnet.h>
#include <asm/ebcdic.h>
#define PNETIDS_LEN 64 /* Total utility string length in bytes
* to cover up to 4 PNETIDs of 16 bytes
* for up to 4 device ports
*/
#define MAX_PNETID_LEN 16 /* Max.length of a single port PNETID */
#define MAX_PNETID_PORTS (PNETIDS_LEN / MAX_PNETID_LEN)
/* Max. # of ports with a PNETID */
/*
* Get the PNETIDs from a device.
* s390 hardware supports the definition of a so-called Physical Network
* Identifier (short PNETID) per network device port. These PNETIDs can be
* used to identify network devices that are attached to the same physical
* network (broadcast domain).
*
* The device can be
* - a ccwgroup device with all bundled subchannels having the same PNETID
* - a PCI attached network device
*
* Returns:
* 0: PNETIDs extracted from device.
* -ENOMEM: No memory to extract utility string.
* -EOPNOTSUPP: Device type without utility string support
*/
static int pnet_ids_by_device(struct device *dev, u8 *pnetids)
{
memset(pnetids, 0, PNETIDS_LEN);
if (dev_is_ccwgroup(dev)) {
struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
u8 *util_str;
util_str = ccw_device_get_util_str(gdev->cdev[0], 0);
if (!util_str)
return -ENOMEM;
memcpy(pnetids, util_str, PNETIDS_LEN);
EBCASC(pnetids, PNETIDS_LEN);
kfree(util_str);
return 0;
}
if (dev_is_pci(dev)) {
struct zpci_dev *zdev = to_zpci(to_pci_dev(dev));
memcpy(pnetids, zdev->util_str, sizeof(zdev->util_str));
EBCASC(pnetids, sizeof(zdev->util_str));
return 0;
}
return -EOPNOTSUPP;
}
/*
* Extract the pnetid for a device port.
*
* Return 0 if a pnetid is found and -ENOENT otherwise.
*/
int pnet_id_by_dev_port(struct device *dev, unsigned short port, u8 *pnetid)
{
u8 pnetids[MAX_PNETID_PORTS][MAX_PNETID_LEN];
static const u8 zero[MAX_PNETID_LEN] = { 0 };
int rc = 0;
if (!dev || port >= MAX_PNETID_PORTS)
return -ENOENT;
if (!pnet_ids_by_device(dev, (u8 *)pnetids) &&
memcmp(pnetids[port], zero, MAX_PNETID_LEN))
memcpy(pnetid, pnetids[port], MAX_PNETID_LEN);
else
rc = -ENOENT;
return rc;
}
EXPORT_SYMBOL_GPL(pnet_id_by_dev_port);
MODULE_DESCRIPTION("pnetid determination from utility strings");
MODULE_LICENSE("GPL");