mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge tag 'pull-riscv-to-apply-20240308-1' of https://github.com/alistair23/qemu into staging
RISC-V PR for 9.0 * Update $ra with current $pc in trans_cm_jalt * Enable SPCR for SCPI virt machine * Allow large kernels to boot by moving the initrd further away in RAM * Sync hwprobe keys with kernel * Named features riscv,isa, 'svade' rework * FIX xATP_MODE validation * Add missing include guard in pmu.h * Add SRAT and SLIT ACPI tables * libqos fixes and add a riscv machine * Add Ztso extension * Use 'zfa' instead of 'Zfa' * Update KVM exts to Linux 6.8 * move ratified/frozen exts to non-experimental * Ensure mcountinhibit, mcounteren, scounteren, hcounteren are 32-bit * mark_vs_dirty() before loads and stores * Remove 'is_store' bool from load/store fns * Fix shift count overflow * Fix setipnum_le write emulation for APLIC MSI-mode * Fix in_clrip[x] read emulation * Fix privilege mode of G-stage translation for debugging * Fix ACPI MCFG table for virt machine # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCAAdFiEEaukCtqfKh31tZZKWr3yVEwxTgBMFAmXq8joACgkQr3yVEwxT # gBMCRxAAvG1RsCxWhMjLYDEYuUhQkP2nd86PHJMrNxAeb5WUIrgrYyT6OLXpfuKN # 8Hz5sR1bJnZSxKfGSFIHoPVxvW788fg7c5fIgg9txEssEQYhd7rCCPALxdiu/zlb # 0fbfx9Ir0nb9qS6vQuT4dEddmljKYKPry8dH0anWI7SVIfdor2TTlP4xOAR88Yq7 # gdGIKvr7PrUhI5JdoWBe8R6w7vguT35EO6aiC+7PA+8AT1SXrxFrg86bYtDUffD+ # LktGcI7GhlIeosolodU8iNK7CdZTywRuyIQ+/KF4mmC7qaC8yJNVVTwX9/vXbH36 # dWIFkOv3VRnLBKt3/PW1DRZoUbSLpWjwH7WZsvQWPW5Ql717pGWId4eXSemxCFLN # u7gGZ29/1jxMuYue+FImHTbBf6fSV25VOfo5ZfR/AfzxLBbugsP56CPwfK3K2OBq # fQ+k3hl8iCx62rZrcAa69TuMBQJB5Q94NIFP1m5u/bPIZZhT311RVY1xx/dRCXnI # 9/7DiPUyMeV4np2j4crvs4/QVTqYvpt4U9ElYrMWUxsTUyBEGEaSzpRsR5FCRmSH # 2IrJsVWw5QsTlHukCMvxWIiWnYS5KIe764LsY31FNOlbl8eNJkyapc+BE8HWjgPa # xYROCWOL7T/E1BPJ7wbEBlzPhuJOndZX91Zbfq0n+SAYq4YnNu4= # =sCqM # -----END PGP SIGNATURE----- # gpg: Signature made Fri 08 Mar 2024 11:10:50 GMT # gpg: using RSA key 6AE902B6A7CA877D6D659296AF7C95130C538013 # gpg: Good signature from "Alistair Francis <alistair@alistair23.me>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 6AE9 02B6 A7CA 877D 6D65 9296 AF7C 9513 0C53 8013 * tag 'pull-riscv-to-apply-20240308-1' of https://github.com/alistair23/qemu: (34 commits) target/riscv: fix ACPI MCFG table target/riscv: Fix privilege mode of G-stage translation for debugging hw/intc/riscv_aplic: Fix in_clrip[x] read emulation hw/intc/riscv_aplic: Fix setipnum_le write emulation for APLIC MSI-mode target/riscv: Fix shift count overflow trans_rvv.c.inc: remove 'is_store' bool from load/store fns trans_rvv.c.inc: mark_vs_dirty() before loads and stores target/riscv: mcountinhibit, mcounteren, scounteren, hcounteren is 32-bit target/riscv: move ratified/frozen exts to non-experimental target/riscv/kvm: update KVM exts to Linux 6.8 linux-headers: Update to Linux v6.8-rc6 tests: riscv64: Use 'zfa' instead of 'Zfa' linux-user/riscv: Add Ztso extension to hwprobe RISC-V: Add support for Ztso tests/libqos: add riscv/virt machine nodes hw/riscv/virt.c: make aclint compatible with 'qtest' accel hw/riscv/virt.c: add virtio-iommu-pci hotplug support hw/riscv/virt.c: create '/soc/pci@...' fdt node earlier hw/riscv/virt-acpi-build.c: Add SRAT and SLIT ACPI tables target/riscv: Add missing include guard in pmu.h ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -1994,6 +1994,59 @@ static void build_processor_hierarchy_node(GArray *tbl, uint32_t flags,
|
||||
}
|
||||
}
|
||||
|
||||
void build_spcr(GArray *table_data, BIOSLinker *linker,
|
||||
const AcpiSpcrData *f, const uint8_t rev,
|
||||
const char *oem_id, const char *oem_table_id)
|
||||
{
|
||||
AcpiTable table = { .sig = "SPCR", .rev = rev, .oem_id = oem_id,
|
||||
.oem_table_id = oem_table_id };
|
||||
|
||||
acpi_table_begin(&table, table_data);
|
||||
/* Interface type */
|
||||
build_append_int_noprefix(table_data, f->interface_type, 1);
|
||||
/* Reserved */
|
||||
build_append_int_noprefix(table_data, 0, 3);
|
||||
/* Base Address */
|
||||
build_append_gas(table_data, f->base_addr.id, f->base_addr.width,
|
||||
f->base_addr.offset, f->base_addr.size,
|
||||
f->base_addr.addr);
|
||||
/* Interrupt type */
|
||||
build_append_int_noprefix(table_data, f->interrupt_type, 1);
|
||||
/* IRQ */
|
||||
build_append_int_noprefix(table_data, f->pc_interrupt, 1);
|
||||
/* Global System Interrupt */
|
||||
build_append_int_noprefix(table_data, f->interrupt, 4);
|
||||
/* Baud Rate */
|
||||
build_append_int_noprefix(table_data, f->baud_rate, 1);
|
||||
/* Parity */
|
||||
build_append_int_noprefix(table_data, f->parity, 1);
|
||||
/* Stop Bits */
|
||||
build_append_int_noprefix(table_data, f->stop_bits, 1);
|
||||
/* Flow Control */
|
||||
build_append_int_noprefix(table_data, f->flow_control, 1);
|
||||
/* Language */
|
||||
build_append_int_noprefix(table_data, f->language, 1);
|
||||
/* Terminal Type */
|
||||
build_append_int_noprefix(table_data, f->terminal_type, 1);
|
||||
/* PCI Device ID */
|
||||
build_append_int_noprefix(table_data, f->pci_device_id, 2);
|
||||
/* PCI Vendor ID */
|
||||
build_append_int_noprefix(table_data, f->pci_vendor_id, 2);
|
||||
/* PCI Bus Number */
|
||||
build_append_int_noprefix(table_data, f->pci_bus, 1);
|
||||
/* PCI Device Number */
|
||||
build_append_int_noprefix(table_data, f->pci_device, 1);
|
||||
/* PCI Function Number */
|
||||
build_append_int_noprefix(table_data, f->pci_function, 1);
|
||||
/* PCI Flags */
|
||||
build_append_int_noprefix(table_data, f->pci_flags, 4);
|
||||
/* PCI Segment */
|
||||
build_append_int_noprefix(table_data, f->pci_segment, 1);
|
||||
/* Reserved */
|
||||
build_append_int_noprefix(table_data, 0, 4);
|
||||
|
||||
acpi_table_end(linker, &table);
|
||||
}
|
||||
/*
|
||||
* ACPI spec, Revision 6.3
|
||||
* 5.2.29 Processor Properties Topology Table (PPTT)
|
||||
|
||||
+27
-41
@@ -431,48 +431,34 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
|
||||
* Rev: 1.07
|
||||
*/
|
||||
static void
|
||||
build_spcr(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
|
||||
spcr_setup(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
|
||||
{
|
||||
AcpiTable table = { .sig = "SPCR", .rev = 2, .oem_id = vms->oem_id,
|
||||
.oem_table_id = vms->oem_table_id };
|
||||
AcpiSpcrData serial = {
|
||||
.interface_type = 3, /* ARM PL011 UART */
|
||||
.base_addr.id = AML_AS_SYSTEM_MEMORY,
|
||||
.base_addr.width = 32,
|
||||
.base_addr.offset = 0,
|
||||
.base_addr.size = 3,
|
||||
.base_addr.addr = vms->memmap[VIRT_UART].base,
|
||||
.interrupt_type = (1 << 3),/* Bit[3] ARMH GIC interrupt*/
|
||||
.pc_interrupt = 0, /* IRQ */
|
||||
.interrupt = (vms->irqmap[VIRT_UART] + ARM_SPI_BASE),
|
||||
.baud_rate = 3, /* 9600 */
|
||||
.parity = 0, /* No Parity */
|
||||
.stop_bits = 1, /* 1 Stop bit */
|
||||
.flow_control = 1 << 1, /* RTS/CTS hardware flow control */
|
||||
.terminal_type = 0, /* VT100 */
|
||||
.language = 0, /* Language */
|
||||
.pci_device_id = 0xffff, /* not a PCI device*/
|
||||
.pci_vendor_id = 0xffff, /* not a PCI device*/
|
||||
.pci_bus = 0,
|
||||
.pci_device = 0,
|
||||
.pci_function = 0,
|
||||
.pci_flags = 0,
|
||||
.pci_segment = 0,
|
||||
};
|
||||
|
||||
acpi_table_begin(&table, table_data);
|
||||
|
||||
/* Interface Type */
|
||||
build_append_int_noprefix(table_data, 3, 1); /* ARM PL011 UART */
|
||||
build_append_int_noprefix(table_data, 0, 3); /* Reserved */
|
||||
/* Base Address */
|
||||
build_append_gas(table_data, AML_AS_SYSTEM_MEMORY, 32, 0, 3,
|
||||
vms->memmap[VIRT_UART].base);
|
||||
/* Interrupt Type */
|
||||
build_append_int_noprefix(table_data,
|
||||
(1 << 3) /* Bit[3] ARMH GIC interrupt */, 1);
|
||||
build_append_int_noprefix(table_data, 0, 1); /* IRQ */
|
||||
/* Global System Interrupt */
|
||||
build_append_int_noprefix(table_data,
|
||||
vms->irqmap[VIRT_UART] + ARM_SPI_BASE, 4);
|
||||
build_append_int_noprefix(table_data, 3 /* 9600 */, 1); /* Baud Rate */
|
||||
build_append_int_noprefix(table_data, 0 /* No Parity */, 1); /* Parity */
|
||||
/* Stop Bits */
|
||||
build_append_int_noprefix(table_data, 1 /* 1 Stop bit */, 1);
|
||||
/* Flow Control */
|
||||
build_append_int_noprefix(table_data,
|
||||
(1 << 1) /* RTS/CTS hardware flow control */, 1);
|
||||
/* Terminal Type */
|
||||
build_append_int_noprefix(table_data, 0 /* VT100 */, 1);
|
||||
build_append_int_noprefix(table_data, 0, 1); /* Language */
|
||||
/* PCI Device ID */
|
||||
build_append_int_noprefix(table_data, 0xffff /* not a PCI device*/, 2);
|
||||
/* PCI Vendor ID */
|
||||
build_append_int_noprefix(table_data, 0xffff /* not a PCI device*/, 2);
|
||||
build_append_int_noprefix(table_data, 0, 1); /* PCI Bus Number */
|
||||
build_append_int_noprefix(table_data, 0, 1); /* PCI Device Number */
|
||||
build_append_int_noprefix(table_data, 0, 1); /* PCI Function Number */
|
||||
build_append_int_noprefix(table_data, 0, 4); /* PCI Flags */
|
||||
build_append_int_noprefix(table_data, 0, 1); /* PCI Segment */
|
||||
build_append_int_noprefix(table_data, 0, 4); /* Reserved */
|
||||
|
||||
acpi_table_end(linker, &table);
|
||||
build_spcr(table_data, linker, &serial, 2, vms->oem_id, vms->oem_table_id);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -938,7 +924,7 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
|
||||
}
|
||||
|
||||
acpi_add_table(table_offsets, tables_blob);
|
||||
build_spcr(tables_blob, tables->linker, vms);
|
||||
spcr_setup(tables_blob, tables->linker, vms);
|
||||
|
||||
acpi_add_table(table_offsets, tables_blob);
|
||||
build_dbg2(tables_blob, tables->linker, vms);
|
||||
|
||||
+31
-6
@@ -162,7 +162,7 @@ static bool is_kvm_aia(bool msimode)
|
||||
static uint32_t riscv_aplic_read_input_word(RISCVAPLICState *aplic,
|
||||
uint32_t word)
|
||||
{
|
||||
uint32_t i, irq, ret = 0;
|
||||
uint32_t i, irq, sourcecfg, sm, raw_input, irq_inverted, ret = 0;
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
irq = word * 32 + i;
|
||||
@@ -170,7 +170,20 @@ static uint32_t riscv_aplic_read_input_word(RISCVAPLICState *aplic,
|
||||
continue;
|
||||
}
|
||||
|
||||
ret |= ((aplic->state[irq] & APLIC_ISTATE_INPUT) ? 1 : 0) << i;
|
||||
sourcecfg = aplic->sourcecfg[irq];
|
||||
if (sourcecfg & APLIC_SOURCECFG_D) {
|
||||
continue;
|
||||
}
|
||||
|
||||
sm = sourcecfg & APLIC_SOURCECFG_SM_MASK;
|
||||
if (sm == APLIC_SOURCECFG_SM_INACTIVE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
raw_input = (aplic->state[irq] & APLIC_ISTATE_INPUT) ? 1 : 0;
|
||||
irq_inverted = (sm == APLIC_SOURCECFG_SM_LEVEL_LOW ||
|
||||
sm == APLIC_SOURCECFG_SM_EDGE_FALL) ? 1 : 0;
|
||||
ret |= (raw_input ^ irq_inverted) << i;
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -218,13 +231,25 @@ static void riscv_aplic_set_pending(RISCVAPLICState *aplic,
|
||||
}
|
||||
|
||||
sm = sourcecfg & APLIC_SOURCECFG_SM_MASK;
|
||||
if ((sm == APLIC_SOURCECFG_SM_INACTIVE) ||
|
||||
((!aplic->msimode || (aplic->msimode && !pending)) &&
|
||||
((sm == APLIC_SOURCECFG_SM_LEVEL_HIGH) ||
|
||||
(sm == APLIC_SOURCECFG_SM_LEVEL_LOW)))) {
|
||||
if (sm == APLIC_SOURCECFG_SM_INACTIVE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((sm == APLIC_SOURCECFG_SM_LEVEL_HIGH) ||
|
||||
(sm == APLIC_SOURCECFG_SM_LEVEL_LOW)) {
|
||||
if (!aplic->msimode || (aplic->msimode && !pending)) {
|
||||
return;
|
||||
}
|
||||
if ((aplic->state[irq] & APLIC_ISTATE_INPUT) &&
|
||||
(sm == APLIC_SOURCECFG_SM_LEVEL_LOW)) {
|
||||
return;
|
||||
}
|
||||
if (!(aplic->state[irq] & APLIC_ISTATE_INPUT) &&
|
||||
(sm == APLIC_SOURCECFG_SM_LEVEL_HIGH)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
riscv_aplic_set_pending_raw(aplic, irq, pending);
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -189,13 +189,13 @@ static void riscv_load_initrd(MachineState *machine, uint64_t kernel_entry)
|
||||
* kernel is uncompressed it will not clobber the initrd. However
|
||||
* on boards without much RAM we must ensure that we still leave
|
||||
* enough room for a decent sized initrd, and on boards with large
|
||||
* amounts of RAM we must avoid the initrd being so far up in RAM
|
||||
* that it is outside lowmem and inaccessible to the kernel.
|
||||
* So for boards with less than 256MB of RAM we put the initrd
|
||||
* halfway into RAM, and for boards with 256MB of RAM or more we put
|
||||
* the initrd at 128MB.
|
||||
* amounts of RAM, we put the initrd at 512MB to allow large kernels
|
||||
* to boot.
|
||||
* So for boards with less than 1GB of RAM we put the initrd
|
||||
* halfway into RAM, and for boards with 1GB of RAM or more we put
|
||||
* the initrd at 512MB.
|
||||
*/
|
||||
start = kernel_entry + MIN(mem_size / 2, 128 * MiB);
|
||||
start = kernel_entry + MIN(mem_size / 2, 512 * MiB);
|
||||
|
||||
size = load_ramdisk(filename, start, mem_size - start);
|
||||
if (size == -1) {
|
||||
|
||||
+101
-2
@@ -174,6 +174,42 @@ acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
|
||||
aml_append(scope, dev);
|
||||
}
|
||||
|
||||
/*
|
||||
* Serial Port Console Redirection Table (SPCR)
|
||||
* Rev: 1.07
|
||||
*/
|
||||
|
||||
static void
|
||||
spcr_setup(GArray *table_data, BIOSLinker *linker, RISCVVirtState *s)
|
||||
{
|
||||
AcpiSpcrData serial = {
|
||||
.interface_type = 0, /* 16550 compatible */
|
||||
.base_addr.id = AML_AS_SYSTEM_MEMORY,
|
||||
.base_addr.width = 32,
|
||||
.base_addr.offset = 0,
|
||||
.base_addr.size = 1,
|
||||
.base_addr.addr = s->memmap[VIRT_UART0].base,
|
||||
.interrupt_type = (1 << 4),/* Bit[4] RISC-V PLIC/APLIC */
|
||||
.pc_interrupt = 0,
|
||||
.interrupt = UART0_IRQ,
|
||||
.baud_rate = 7, /* 15200 */
|
||||
.parity = 0,
|
||||
.stop_bits = 1,
|
||||
.flow_control = 0,
|
||||
.terminal_type = 3, /* ANSI */
|
||||
.language = 0, /* Language */
|
||||
.pci_device_id = 0xffff, /* not a PCI device*/
|
||||
.pci_vendor_id = 0xffff, /* not a PCI device*/
|
||||
.pci_bus = 0,
|
||||
.pci_device = 0,
|
||||
.pci_function = 0,
|
||||
.pci_flags = 0,
|
||||
.pci_segment = 0,
|
||||
};
|
||||
|
||||
build_spcr(table_data, linker, &serial, 2, s->oem_id, s->oem_table_id);
|
||||
}
|
||||
|
||||
/* RHCT Node[N] starts at offset 56 */
|
||||
#define RHCT_NODE_ARRAY_OFFSET 56
|
||||
|
||||
@@ -528,11 +564,61 @@ static void build_madt(GArray *table_data,
|
||||
acpi_table_end(linker, &table);
|
||||
}
|
||||
|
||||
/*
|
||||
* ACPI spec, Revision 6.5+
|
||||
* 5.2.16 System Resource Affinity Table (SRAT)
|
||||
* REF: https://github.com/riscv-non-isa/riscv-acpi/issues/25
|
||||
* https://drive.google.com/file/d/1YTdDx2IPm5IeZjAW932EYU-tUtgS08tX/view
|
||||
*/
|
||||
static void
|
||||
build_srat(GArray *table_data, BIOSLinker *linker, RISCVVirtState *vms)
|
||||
{
|
||||
int i;
|
||||
uint64_t mem_base;
|
||||
MachineClass *mc = MACHINE_GET_CLASS(vms);
|
||||
MachineState *ms = MACHINE(vms);
|
||||
const CPUArchIdList *cpu_list = mc->possible_cpu_arch_ids(ms);
|
||||
AcpiTable table = { .sig = "SRAT", .rev = 3, .oem_id = vms->oem_id,
|
||||
.oem_table_id = vms->oem_table_id };
|
||||
|
||||
acpi_table_begin(&table, table_data);
|
||||
build_append_int_noprefix(table_data, 1, 4); /* Reserved */
|
||||
build_append_int_noprefix(table_data, 0, 8); /* Reserved */
|
||||
|
||||
for (i = 0; i < cpu_list->len; ++i) {
|
||||
uint32_t nodeid = cpu_list->cpus[i].props.node_id;
|
||||
/*
|
||||
* 5.2.16.8 RINTC Affinity Structure
|
||||
*/
|
||||
build_append_int_noprefix(table_data, 7, 1); /* Type */
|
||||
build_append_int_noprefix(table_data, 20, 1); /* Length */
|
||||
build_append_int_noprefix(table_data, 0, 2); /* Reserved */
|
||||
build_append_int_noprefix(table_data, nodeid, 4); /* Proximity Domain */
|
||||
build_append_int_noprefix(table_data, i, 4); /* ACPI Processor UID */
|
||||
/* Flags, Table 5-70 */
|
||||
build_append_int_noprefix(table_data, 1 /* Flags: Enabled */, 4);
|
||||
build_append_int_noprefix(table_data, 0, 4); /* Clock Domain */
|
||||
}
|
||||
|
||||
mem_base = vms->memmap[VIRT_DRAM].base;
|
||||
for (i = 0; i < ms->numa_state->num_nodes; ++i) {
|
||||
if (ms->numa_state->nodes[i].node_mem > 0) {
|
||||
build_srat_memory(table_data, mem_base,
|
||||
ms->numa_state->nodes[i].node_mem, i,
|
||||
MEM_AFFINITY_ENABLED);
|
||||
mem_base += ms->numa_state->nodes[i].node_mem;
|
||||
}
|
||||
}
|
||||
|
||||
acpi_table_end(linker, &table);
|
||||
}
|
||||
|
||||
static void virt_acpi_build(RISCVVirtState *s, AcpiBuildTables *tables)
|
||||
{
|
||||
GArray *table_offsets;
|
||||
unsigned dsdt, xsdt;
|
||||
GArray *tables_blob = tables->table_data;
|
||||
MachineState *ms = MACHINE(s);
|
||||
|
||||
table_offsets = g_array_new(false, true,
|
||||
sizeof(uint32_t));
|
||||
@@ -555,16 +641,29 @@ static void virt_acpi_build(RISCVVirtState *s, AcpiBuildTables *tables)
|
||||
acpi_add_table(table_offsets, tables_blob);
|
||||
build_rhct(tables_blob, tables->linker, s);
|
||||
|
||||
acpi_add_table(table_offsets, tables_blob);
|
||||
spcr_setup(tables_blob, tables->linker, s);
|
||||
|
||||
acpi_add_table(table_offsets, tables_blob);
|
||||
{
|
||||
AcpiMcfgInfo mcfg = {
|
||||
.base = s->memmap[VIRT_PCIE_MMIO].base,
|
||||
.size = s->memmap[VIRT_PCIE_MMIO].size,
|
||||
.base = s->memmap[VIRT_PCIE_ECAM].base,
|
||||
.size = s->memmap[VIRT_PCIE_ECAM].size,
|
||||
};
|
||||
build_mcfg(tables_blob, tables->linker, &mcfg, s->oem_id,
|
||||
s->oem_table_id);
|
||||
}
|
||||
|
||||
if (ms->numa_state->num_nodes > 0) {
|
||||
acpi_add_table(table_offsets, tables_blob);
|
||||
build_srat(tables_blob, tables->linker, s);
|
||||
if (ms->numa_state->have_numa_distance) {
|
||||
acpi_add_table(table_offsets, tables_blob);
|
||||
build_slit(tables_blob, tables->linker, ms, s->oem_id,
|
||||
s->oem_table_id);
|
||||
}
|
||||
}
|
||||
|
||||
/* XSDT is pointed to by RSDP */
|
||||
xsdt = tables_blob->len;
|
||||
build_xsdt(tables_blob, tables->linker, table_offsets, s->oem_id,
|
||||
|
||||
+70
-27
@@ -48,11 +48,13 @@
|
||||
#include "sysemu/tcg.h"
|
||||
#include "sysemu/kvm.h"
|
||||
#include "sysemu/tpm.h"
|
||||
#include "sysemu/qtest.h"
|
||||
#include "hw/pci/pci.h"
|
||||
#include "hw/pci-host/gpex.h"
|
||||
#include "hw/display/ramfb.h"
|
||||
#include "hw/acpi/aml-build.h"
|
||||
#include "qapi/qapi-visit-common.h"
|
||||
#include "hw/virtio/virtio-iommu.h"
|
||||
|
||||
/* KVM AIA only supports APLIC MSI. APLIC Wired is always emulated by QEMU. */
|
||||
static bool virt_use_kvm_aia(RISCVVirtState *s)
|
||||
@@ -60,6 +62,11 @@ static bool virt_use_kvm_aia(RISCVVirtState *s)
|
||||
return kvm_irqchip_in_kernel() && s->aia_type == VIRT_AIA_TYPE_APLIC_IMSIC;
|
||||
}
|
||||
|
||||
static bool virt_aclint_allowed(void)
|
||||
{
|
||||
return tcg_enabled() || qtest_enabled();
|
||||
}
|
||||
|
||||
static const MemMapEntry virt_memmap[] = {
|
||||
[VIRT_DEBUG] = { 0x0, 0x100 },
|
||||
[VIRT_MROM] = { 0x1000, 0xf000 },
|
||||
@@ -724,14 +731,12 @@ static void create_fdt_sockets(RISCVVirtState *s, const MemMapEntry *memmap,
|
||||
|
||||
create_fdt_socket_memory(s, memmap, socket);
|
||||
|
||||
if (tcg_enabled()) {
|
||||
if (s->have_aclint) {
|
||||
create_fdt_socket_aclint(s, memmap, socket,
|
||||
&intc_phandles[phandle_pos]);
|
||||
} else {
|
||||
create_fdt_socket_clint(s, memmap, socket,
|
||||
&intc_phandles[phandle_pos]);
|
||||
}
|
||||
if (virt_aclint_allowed() && s->have_aclint) {
|
||||
create_fdt_socket_aclint(s, memmap, socket,
|
||||
&intc_phandles[phandle_pos]);
|
||||
} else if (tcg_enabled()) {
|
||||
create_fdt_socket_clint(s, memmap, socket,
|
||||
&intc_phandles[phandle_pos]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -826,7 +831,6 @@ static void create_fdt_pcie(RISCVVirtState *s, const MemMapEntry *memmap,
|
||||
|
||||
name = g_strdup_printf("/soc/pci@%lx",
|
||||
(long) memmap[VIRT_PCIE_ECAM].base);
|
||||
qemu_fdt_add_subnode(ms->fdt, name);
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "#address-cells",
|
||||
FDT_PCI_ADDR_CELLS);
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "#interrupt-cells",
|
||||
@@ -972,6 +976,34 @@ static void create_fdt_fw_cfg(RISCVVirtState *s, const MemMapEntry *memmap)
|
||||
qemu_fdt_setprop(ms->fdt, nodename, "dma-coherent", NULL, 0);
|
||||
}
|
||||
|
||||
static void create_fdt_virtio_iommu(RISCVVirtState *s, uint16_t bdf)
|
||||
{
|
||||
const char compat[] = "virtio,pci-iommu\0pci1af4,1057";
|
||||
void *fdt = MACHINE(s)->fdt;
|
||||
uint32_t iommu_phandle;
|
||||
g_autofree char *iommu_node = NULL;
|
||||
g_autofree char *pci_node = NULL;
|
||||
|
||||
pci_node = g_strdup_printf("/soc/pci@%lx",
|
||||
(long) virt_memmap[VIRT_PCIE_ECAM].base);
|
||||
iommu_node = g_strdup_printf("%s/virtio_iommu@%x,%x", pci_node,
|
||||
PCI_SLOT(bdf), PCI_FUNC(bdf));
|
||||
iommu_phandle = qemu_fdt_alloc_phandle(fdt);
|
||||
|
||||
qemu_fdt_add_subnode(fdt, iommu_node);
|
||||
|
||||
qemu_fdt_setprop(fdt, iommu_node, "compatible", compat, sizeof(compat));
|
||||
qemu_fdt_setprop_sized_cells(fdt, iommu_node, "reg",
|
||||
1, bdf << 8, 1, 0, 1, 0,
|
||||
1, 0, 1, 0);
|
||||
qemu_fdt_setprop_cell(fdt, iommu_node, "#iommu-cells", 1);
|
||||
qemu_fdt_setprop_cell(fdt, iommu_node, "phandle", iommu_phandle);
|
||||
|
||||
qemu_fdt_setprop_cells(fdt, pci_node, "iommu-map",
|
||||
0, iommu_phandle, 0, bdf,
|
||||
bdf + 1, iommu_phandle, bdf + 1, 0xffff - bdf);
|
||||
}
|
||||
|
||||
static void finalize_fdt(RISCVVirtState *s)
|
||||
{
|
||||
uint32_t phandle = 1, irq_mmio_phandle = 1, msi_pcie_phandle = 1;
|
||||
@@ -996,6 +1028,7 @@ static void create_fdt(RISCVVirtState *s, const MemMapEntry *memmap)
|
||||
{
|
||||
MachineState *ms = MACHINE(s);
|
||||
uint8_t rng_seed[32];
|
||||
g_autofree char *name = NULL;
|
||||
|
||||
ms->fdt = create_device_tree(&s->fdt_size);
|
||||
if (!ms->fdt) {
|
||||
@@ -1014,6 +1047,13 @@ static void create_fdt(RISCVVirtState *s, const MemMapEntry *memmap)
|
||||
qemu_fdt_setprop_cell(ms->fdt, "/soc", "#size-cells", 0x2);
|
||||
qemu_fdt_setprop_cell(ms->fdt, "/soc", "#address-cells", 0x2);
|
||||
|
||||
/*
|
||||
* The "/soc/pci@..." node is needed for PCIE hotplugs
|
||||
* that might happen before finalize_fdt().
|
||||
*/
|
||||
name = g_strdup_printf("/soc/pci@%lx", (long) memmap[VIRT_PCIE_ECAM].base);
|
||||
qemu_fdt_add_subnode(ms->fdt, name);
|
||||
|
||||
qemu_fdt_add_subnode(ms->fdt, "/chosen");
|
||||
|
||||
/* Pass seed to RNG */
|
||||
@@ -1373,7 +1413,7 @@ static void virt_machine_init(MachineState *machine)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!tcg_enabled() && s->have_aclint) {
|
||||
if (!virt_aclint_allowed() && s->have_aclint) {
|
||||
error_report("'aclint' is only available with TCG acceleration");
|
||||
exit(1);
|
||||
}
|
||||
@@ -1410,23 +1450,22 @@ static void virt_machine_init(MachineState *machine)
|
||||
hart_count, &error_abort);
|
||||
sysbus_realize(SYS_BUS_DEVICE(&s->soc[i]), &error_fatal);
|
||||
|
||||
if (tcg_enabled()) {
|
||||
if (s->have_aclint) {
|
||||
if (s->aia_type == VIRT_AIA_TYPE_APLIC_IMSIC) {
|
||||
/* Per-socket ACLINT MTIMER */
|
||||
riscv_aclint_mtimer_create(memmap[VIRT_CLINT].base +
|
||||
if (virt_aclint_allowed() && s->have_aclint) {
|
||||
if (s->aia_type == VIRT_AIA_TYPE_APLIC_IMSIC) {
|
||||
/* Per-socket ACLINT MTIMER */
|
||||
riscv_aclint_mtimer_create(memmap[VIRT_CLINT].base +
|
||||
i * RISCV_ACLINT_DEFAULT_MTIMER_SIZE,
|
||||
RISCV_ACLINT_DEFAULT_MTIMER_SIZE,
|
||||
base_hartid, hart_count,
|
||||
RISCV_ACLINT_DEFAULT_MTIMECMP,
|
||||
RISCV_ACLINT_DEFAULT_MTIME,
|
||||
RISCV_ACLINT_DEFAULT_TIMEBASE_FREQ, true);
|
||||
} else {
|
||||
/* Per-socket ACLINT MSWI, MTIMER, and SSWI */
|
||||
riscv_aclint_swi_create(memmap[VIRT_CLINT].base +
|
||||
} else {
|
||||
/* Per-socket ACLINT MSWI, MTIMER, and SSWI */
|
||||
riscv_aclint_swi_create(memmap[VIRT_CLINT].base +
|
||||
i * memmap[VIRT_CLINT].size,
|
||||
base_hartid, hart_count, false);
|
||||
riscv_aclint_mtimer_create(memmap[VIRT_CLINT].base +
|
||||
riscv_aclint_mtimer_create(memmap[VIRT_CLINT].base +
|
||||
i * memmap[VIRT_CLINT].size +
|
||||
RISCV_ACLINT_SWI_SIZE,
|
||||
RISCV_ACLINT_DEFAULT_MTIMER_SIZE,
|
||||
@@ -1434,21 +1473,20 @@ static void virt_machine_init(MachineState *machine)
|
||||
RISCV_ACLINT_DEFAULT_MTIMECMP,
|
||||
RISCV_ACLINT_DEFAULT_MTIME,
|
||||
RISCV_ACLINT_DEFAULT_TIMEBASE_FREQ, true);
|
||||
riscv_aclint_swi_create(memmap[VIRT_ACLINT_SSWI].base +
|
||||
riscv_aclint_swi_create(memmap[VIRT_ACLINT_SSWI].base +
|
||||
i * memmap[VIRT_ACLINT_SSWI].size,
|
||||
base_hartid, hart_count, true);
|
||||
}
|
||||
} else {
|
||||
/* Per-socket SiFive CLINT */
|
||||
riscv_aclint_swi_create(
|
||||
}
|
||||
} else if (tcg_enabled()) {
|
||||
/* Per-socket SiFive CLINT */
|
||||
riscv_aclint_swi_create(
|
||||
memmap[VIRT_CLINT].base + i * memmap[VIRT_CLINT].size,
|
||||
base_hartid, hart_count, false);
|
||||
riscv_aclint_mtimer_create(memmap[VIRT_CLINT].base +
|
||||
riscv_aclint_mtimer_create(memmap[VIRT_CLINT].base +
|
||||
i * memmap[VIRT_CLINT].size + RISCV_ACLINT_SWI_SIZE,
|
||||
RISCV_ACLINT_DEFAULT_MTIMER_SIZE, base_hartid, hart_count,
|
||||
RISCV_ACLINT_DEFAULT_MTIMECMP, RISCV_ACLINT_DEFAULT_MTIME,
|
||||
RISCV_ACLINT_DEFAULT_TIMEBASE_FREQ, true);
|
||||
}
|
||||
}
|
||||
|
||||
/* Per-socket interrupt controller */
|
||||
@@ -1673,7 +1711,8 @@ static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *machine,
|
||||
{
|
||||
MachineClass *mc = MACHINE_GET_CLASS(machine);
|
||||
|
||||
if (device_is_dynamic_sysbus(mc, dev)) {
|
||||
if (device_is_dynamic_sysbus(mc, dev) ||
|
||||
object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) {
|
||||
return HOTPLUG_HANDLER(machine);
|
||||
}
|
||||
return NULL;
|
||||
@@ -1692,6 +1731,10 @@ static void virt_machine_device_plug_cb(HotplugHandler *hotplug_dev,
|
||||
SYS_BUS_DEVICE(dev));
|
||||
}
|
||||
}
|
||||
|
||||
if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) {
|
||||
create_fdt_virtio_iommu(s, pci_get_bdf(PCI_DEVICE(dev)));
|
||||
}
|
||||
}
|
||||
|
||||
static void virt_machine_class_init(ObjectClass *oc, void *data)
|
||||
|
||||
@@ -90,6 +90,39 @@ typedef struct AcpiFadtData {
|
||||
unsigned *xdsdt_tbl_offset;
|
||||
} AcpiFadtData;
|
||||
|
||||
typedef struct AcpiGas {
|
||||
uint8_t id; /* Address space ID */
|
||||
uint8_t width; /* Register bit width */
|
||||
uint8_t offset; /* Register bit offset */
|
||||
uint8_t size; /* Access size */
|
||||
uint64_t addr; /* Address */
|
||||
} AcpiGas;
|
||||
|
||||
/* SPCR (Serial Port Console Redirection table) */
|
||||
typedef struct AcpiSpcrData {
|
||||
uint8_t interface_type;
|
||||
uint8_t reserved[3];
|
||||
struct AcpiGas base_addr;
|
||||
uint8_t interrupt_type;
|
||||
uint8_t pc_interrupt;
|
||||
uint32_t interrupt; /* Global system interrupt */
|
||||
uint8_t baud_rate;
|
||||
uint8_t parity;
|
||||
uint8_t stop_bits;
|
||||
uint8_t flow_control;
|
||||
uint8_t terminal_type;
|
||||
uint8_t language;
|
||||
uint8_t reserved1;
|
||||
uint16_t pci_device_id; /* Must be 0xffff if not PCI device */
|
||||
uint16_t pci_vendor_id; /* Must be 0xffff if not PCI device */
|
||||
uint8_t pci_bus;
|
||||
uint8_t pci_device;
|
||||
uint8_t pci_function;
|
||||
uint32_t pci_flags;
|
||||
uint8_t pci_segment;
|
||||
uint32_t reserved2;
|
||||
} AcpiSpcrData;
|
||||
|
||||
#define ACPI_FADT_ARM_PSCI_COMPLIANT (1 << 0)
|
||||
#define ACPI_FADT_ARM_PSCI_USE_HVC (1 << 1)
|
||||
|
||||
|
||||
@@ -497,4 +497,8 @@ void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f,
|
||||
|
||||
void build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog,
|
||||
const char *oem_id, const char *oem_table_id);
|
||||
|
||||
void build_spcr(GArray *table_data, BIOSLinker *linker,
|
||||
const AcpiSpcrData *f, const uint8_t rev,
|
||||
const char *oem_id, const char *oem_table_id);
|
||||
#endif
|
||||
|
||||
@@ -53,7 +53,7 @@ extern "C" {
|
||||
* Format modifiers may change any property of the buffer, including the number
|
||||
* of planes and/or the required allocation size. Format modifiers are
|
||||
* vendor-namespaced, and as such the relationship between a fourcc code and a
|
||||
* modifier is specific to the modifer being used. For example, some modifiers
|
||||
* modifier is specific to the modifier being used. For example, some modifiers
|
||||
* may preserve meaning - such as number of planes - from the fourcc code,
|
||||
* whereas others may not.
|
||||
*
|
||||
@@ -78,7 +78,7 @@ extern "C" {
|
||||
* format.
|
||||
* - Higher-level programs interfacing with KMS/GBM/EGL/Vulkan/etc: these users
|
||||
* see modifiers as opaque tokens they can check for equality and intersect.
|
||||
* These users musn't need to know to reason about the modifier value
|
||||
* These users mustn't need to know to reason about the modifier value
|
||||
* (i.e. they are not expected to extract information out of the modifier).
|
||||
*
|
||||
* Vendors should document their modifier usage in as much detail as
|
||||
@@ -539,7 +539,7 @@ extern "C" {
|
||||
* This is a tiled layout using 4Kb tiles in row-major layout.
|
||||
* Within the tile pixels are laid out in 16 256 byte units / sub-tiles which
|
||||
* are arranged in four groups (two wide, two high) with column-major layout.
|
||||
* Each group therefore consits out of four 256 byte units, which are also laid
|
||||
* Each group therefore consists out of four 256 byte units, which are also laid
|
||||
* out as 2x2 column-major.
|
||||
* 256 byte units are made out of four 64 byte blocks of pixels, producing
|
||||
* either a square block or a 2:1 unit.
|
||||
@@ -1102,7 +1102,7 @@ drm_fourcc_canonicalize_nvidia_format_mod(uint64_t modifier)
|
||||
*/
|
||||
|
||||
/*
|
||||
* The top 4 bits (out of the 56 bits alloted for specifying vendor specific
|
||||
* The top 4 bits (out of the 56 bits allotted for specifying vendor specific
|
||||
* modifiers) denote the category for modifiers. Currently we have three
|
||||
* categories of modifiers ie AFBC, MISC and AFRC. We can have a maximum of
|
||||
* sixteen different categories.
|
||||
@@ -1418,7 +1418,7 @@ drm_fourcc_canonicalize_nvidia_format_mod(uint64_t modifier)
|
||||
* Amlogic FBC Memory Saving mode
|
||||
*
|
||||
* Indicates the storage is packed when pixel size is multiple of word
|
||||
* boudaries, i.e. 8bit should be stored in this mode to save allocation
|
||||
* boundaries, i.e. 8bit should be stored in this mode to save allocation
|
||||
* memory.
|
||||
*
|
||||
* This mode reduces body layout to 3072 bytes per 64x32 superblock with
|
||||
|
||||
@@ -1266,6 +1266,8 @@ struct ethtool_rxfh_indir {
|
||||
* hardware hash key.
|
||||
* @hfunc: Defines the current RSS hash function used by HW (or to be set to).
|
||||
* Valid values are one of the %ETH_RSS_HASH_*.
|
||||
* @input_xfrm: Defines how the input data is transformed. Valid values are one
|
||||
* of %RXH_XFRM_*.
|
||||
* @rsvd8: Reserved for future use; see the note on reserved space.
|
||||
* @rsvd32: Reserved for future use; see the note on reserved space.
|
||||
* @rss_config: RX ring/queue index for each hash value i.e., indirection table
|
||||
@@ -1285,7 +1287,8 @@ struct ethtool_rxfh {
|
||||
uint32_t indir_size;
|
||||
uint32_t key_size;
|
||||
uint8_t hfunc;
|
||||
uint8_t rsvd8[3];
|
||||
uint8_t input_xfrm;
|
||||
uint8_t rsvd8[2];
|
||||
uint32_t rsvd32;
|
||||
uint32_t rss_config[];
|
||||
};
|
||||
@@ -1992,6 +1995,15 @@ static inline int ethtool_validate_duplex(uint8_t duplex)
|
||||
|
||||
#define WOL_MODE_COUNT 8
|
||||
|
||||
/* RSS hash function data
|
||||
* XOR the corresponding source and destination fields of each specified
|
||||
* protocol. Both copies of the XOR'ed fields are fed into the RSS and RXHASH
|
||||
* calculation. Note that this XORing reduces the input set entropy and could
|
||||
* be exploited to reduce the RSS queue spread.
|
||||
*/
|
||||
#define RXH_XFRM_SYM_XOR (1 << 0)
|
||||
#define RXH_XFRM_NO_CHANGE 0xff
|
||||
|
||||
/* L2-L4 network traffic flow types */
|
||||
#define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */
|
||||
#define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */
|
||||
@@ -2128,18 +2140,6 @@ enum ethtool_reset_flags {
|
||||
* refused. For drivers: ignore this field (use kernel's
|
||||
* __ETHTOOL_LINK_MODE_MASK_NBITS instead), any change to it will
|
||||
* be overwritten by kernel.
|
||||
* @supported: Bitmap with each bit meaning given by
|
||||
* %ethtool_link_mode_bit_indices for the link modes, physical
|
||||
* connectors and other link features for which the interface
|
||||
* supports autonegotiation or auto-detection. Read-only.
|
||||
* @advertising: Bitmap with each bit meaning given by
|
||||
* %ethtool_link_mode_bit_indices for the link modes, physical
|
||||
* connectors and other link features that are advertised through
|
||||
* autonegotiation or enabled for auto-detection.
|
||||
* @lp_advertising: Bitmap with each bit meaning given by
|
||||
* %ethtool_link_mode_bit_indices for the link modes, and other
|
||||
* link features that the link partner advertised through
|
||||
* autonegotiation; 0 if unknown or not applicable. Read-only.
|
||||
* @transceiver: Used to distinguish different possible PHY types,
|
||||
* reported consistently by PHYLIB. Read-only.
|
||||
* @master_slave_cfg: Master/slave port mode.
|
||||
@@ -2181,6 +2181,21 @@ enum ethtool_reset_flags {
|
||||
* %set_link_ksettings() should validate all fields other than @cmd
|
||||
* and @link_mode_masks_nwords that are not described as read-only or
|
||||
* deprecated, and must ignore all fields described as read-only.
|
||||
*
|
||||
* @link_mode_masks is divided into three bitfields, each of length
|
||||
* @link_mode_masks_nwords:
|
||||
* - supported: Bitmap with each bit meaning given by
|
||||
* %ethtool_link_mode_bit_indices for the link modes, physical
|
||||
* connectors and other link features for which the interface
|
||||
* supports autonegotiation or auto-detection. Read-only.
|
||||
* - advertising: Bitmap with each bit meaning given by
|
||||
* %ethtool_link_mode_bit_indices for the link modes, physical
|
||||
* connectors and other link features that are advertised through
|
||||
* autonegotiation or enabled for auto-detection.
|
||||
* - lp_advertising: Bitmap with each bit meaning given by
|
||||
* %ethtool_link_mode_bit_indices for the link modes, and other
|
||||
* link features that the link partner advertised through
|
||||
* autonegotiation; 0 if unknown or not applicable. Read-only.
|
||||
*/
|
||||
struct ethtool_link_settings {
|
||||
uint32_t cmd;
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
* rest are per-device feature bits.
|
||||
*/
|
||||
#define VIRTIO_TRANSPORT_F_START 28
|
||||
#define VIRTIO_TRANSPORT_F_END 41
|
||||
#define VIRTIO_TRANSPORT_F_END 42
|
||||
|
||||
#ifndef VIRTIO_CONFIG_NO_LEGACY
|
||||
/* Do we get callbacks when the ring is completely used, even if we've
|
||||
@@ -112,4 +112,10 @@
|
||||
* This feature indicates that the driver can reset a queue individually.
|
||||
*/
|
||||
#define VIRTIO_F_RING_RESET 40
|
||||
|
||||
/*
|
||||
* This feature indicates that the device support administration virtqueues.
|
||||
*/
|
||||
#define VIRTIO_F_ADMIN_VQ 41
|
||||
|
||||
#endif /* _LINUX_VIRTIO_CONFIG_H */
|
||||
|
||||
@@ -175,6 +175,9 @@ struct virtio_pci_modern_common_cfg {
|
||||
|
||||
uint16_t queue_notify_data; /* read-write */
|
||||
uint16_t queue_reset; /* read-write */
|
||||
|
||||
uint16_t admin_queue_index; /* read-only */
|
||||
uint16_t admin_queue_num; /* read-only */
|
||||
};
|
||||
|
||||
/* Fields in VIRTIO_PCI_CAP_PCI_CFG: */
|
||||
@@ -215,7 +218,72 @@ struct virtio_pci_cfg_cap {
|
||||
#define VIRTIO_PCI_COMMON_Q_USEDHI 52
|
||||
#define VIRTIO_PCI_COMMON_Q_NDATA 56
|
||||
#define VIRTIO_PCI_COMMON_Q_RESET 58
|
||||
#define VIRTIO_PCI_COMMON_ADM_Q_IDX 60
|
||||
#define VIRTIO_PCI_COMMON_ADM_Q_NUM 62
|
||||
|
||||
#endif /* VIRTIO_PCI_NO_MODERN */
|
||||
|
||||
/* Admin command status. */
|
||||
#define VIRTIO_ADMIN_STATUS_OK 0
|
||||
|
||||
/* Admin command opcode. */
|
||||
#define VIRTIO_ADMIN_CMD_LIST_QUERY 0x0
|
||||
#define VIRTIO_ADMIN_CMD_LIST_USE 0x1
|
||||
|
||||
/* Admin command group type. */
|
||||
#define VIRTIO_ADMIN_GROUP_TYPE_SRIOV 0x1
|
||||
|
||||
/* Transitional device admin command. */
|
||||
#define VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE 0x2
|
||||
#define VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_READ 0x3
|
||||
#define VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_WRITE 0x4
|
||||
#define VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_READ 0x5
|
||||
#define VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO 0x6
|
||||
|
||||
struct QEMU_PACKED virtio_admin_cmd_hdr {
|
||||
uint16_t opcode;
|
||||
/*
|
||||
* 1 - SR-IOV
|
||||
* 2-65535 - reserved
|
||||
*/
|
||||
uint16_t group_type;
|
||||
/* Unused, reserved for future extensions. */
|
||||
uint8_t reserved1[12];
|
||||
uint64_t group_member_id;
|
||||
};
|
||||
|
||||
struct QEMU_PACKED virtio_admin_cmd_status {
|
||||
uint16_t status;
|
||||
uint16_t status_qualifier;
|
||||
/* Unused, reserved for future extensions. */
|
||||
uint8_t reserved2[4];
|
||||
};
|
||||
|
||||
struct QEMU_PACKED virtio_admin_cmd_legacy_wr_data {
|
||||
uint8_t offset; /* Starting offset of the register(s) to write. */
|
||||
uint8_t reserved[7];
|
||||
uint8_t registers[];
|
||||
};
|
||||
|
||||
struct QEMU_PACKED virtio_admin_cmd_legacy_rd_data {
|
||||
uint8_t offset; /* Starting offset of the register(s) to read. */
|
||||
};
|
||||
|
||||
#define VIRTIO_ADMIN_CMD_NOTIFY_INFO_FLAGS_END 0
|
||||
#define VIRTIO_ADMIN_CMD_NOTIFY_INFO_FLAGS_OWNER_DEV 0x1
|
||||
#define VIRTIO_ADMIN_CMD_NOTIFY_INFO_FLAGS_OWNER_MEM 0x2
|
||||
|
||||
#define VIRTIO_ADMIN_CMD_MAX_NOTIFY_INFO 4
|
||||
|
||||
struct QEMU_PACKED virtio_admin_cmd_notify_info_data {
|
||||
uint8_t flags; /* 0 = end of list, 1 = owner device, 2 = member device */
|
||||
uint8_t bar; /* BAR of the member or the owner device */
|
||||
uint8_t padding[6];
|
||||
uint64_t offset; /* Offset within bar. */
|
||||
};
|
||||
|
||||
struct virtio_admin_cmd_notify_info_result {
|
||||
struct virtio_admin_cmd_notify_info_data entries[VIRTIO_ADMIN_CMD_MAX_NOTIFY_INFO];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,6 +14,13 @@
|
||||
#include "standard-headers/linux/virtio_ids.h"
|
||||
#include "standard-headers/linux/virtio_config.h"
|
||||
|
||||
/* Feature bits */
|
||||
/* guest physical address range will be indicated as shared memory region 0 */
|
||||
#define VIRTIO_PMEM_F_SHMEM_REGION 0
|
||||
|
||||
/* shmid of the shared memory region corresponding to the pmem */
|
||||
#define VIRTIO_PMEM_SHMEM_REGION_ID 0
|
||||
|
||||
struct virtio_pmem_config {
|
||||
uint64_t start;
|
||||
uint64_t size;
|
||||
|
||||
@@ -829,8 +829,21 @@ __SYSCALL(__NR_futex_wait, sys_futex_wait)
|
||||
#define __NR_futex_requeue 456
|
||||
__SYSCALL(__NR_futex_requeue, sys_futex_requeue)
|
||||
|
||||
#define __NR_statmount 457
|
||||
__SYSCALL(__NR_statmount, sys_statmount)
|
||||
|
||||
#define __NR_listmount 458
|
||||
__SYSCALL(__NR_listmount, sys_listmount)
|
||||
|
||||
#define __NR_lsm_get_self_attr 459
|
||||
__SYSCALL(__NR_lsm_get_self_attr, sys_lsm_get_self_attr)
|
||||
#define __NR_lsm_set_self_attr 460
|
||||
__SYSCALL(__NR_lsm_set_self_attr, sys_lsm_set_self_attr)
|
||||
#define __NR_lsm_list_modules 461
|
||||
__SYSCALL(__NR_lsm_list_modules, sys_lsm_list_modules)
|
||||
|
||||
#undef __NR_syscalls
|
||||
#define __NR_syscalls 457
|
||||
#define __NR_syscalls 462
|
||||
|
||||
/*
|
||||
* 32 bit systems traditionally used different
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
#define MADV_HUGEPAGE 14 /* Worth backing with hugepages */
|
||||
#define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */
|
||||
|
||||
#define MADV_DONTDUMP 16 /* Explicity exclude from the core dump,
|
||||
#define MADV_DONTDUMP 16 /* Explicitly exclude from core dump,
|
||||
overrides the coredump filter bits */
|
||||
#define MADV_DODUMP 17 /* Clear the MADV_NODUMP flag */
|
||||
|
||||
|
||||
@@ -385,5 +385,10 @@
|
||||
#define __NR_futex_wake (__NR_Linux + 454)
|
||||
#define __NR_futex_wait (__NR_Linux + 455)
|
||||
#define __NR_futex_requeue (__NR_Linux + 456)
|
||||
#define __NR_statmount (__NR_Linux + 457)
|
||||
#define __NR_listmount (__NR_Linux + 458)
|
||||
#define __NR_lsm_get_self_attr (__NR_Linux + 459)
|
||||
#define __NR_lsm_set_self_attr (__NR_Linux + 460)
|
||||
#define __NR_lsm_list_modules (__NR_Linux + 461)
|
||||
|
||||
#endif /* _ASM_UNISTD_N32_H */
|
||||
|
||||
@@ -361,5 +361,10 @@
|
||||
#define __NR_futex_wake (__NR_Linux + 454)
|
||||
#define __NR_futex_wait (__NR_Linux + 455)
|
||||
#define __NR_futex_requeue (__NR_Linux + 456)
|
||||
#define __NR_statmount (__NR_Linux + 457)
|
||||
#define __NR_listmount (__NR_Linux + 458)
|
||||
#define __NR_lsm_get_self_attr (__NR_Linux + 459)
|
||||
#define __NR_lsm_set_self_attr (__NR_Linux + 460)
|
||||
#define __NR_lsm_list_modules (__NR_Linux + 461)
|
||||
|
||||
#endif /* _ASM_UNISTD_N64_H */
|
||||
|
||||
@@ -431,5 +431,10 @@
|
||||
#define __NR_futex_wake (__NR_Linux + 454)
|
||||
#define __NR_futex_wait (__NR_Linux + 455)
|
||||
#define __NR_futex_requeue (__NR_Linux + 456)
|
||||
#define __NR_statmount (__NR_Linux + 457)
|
||||
#define __NR_listmount (__NR_Linux + 458)
|
||||
#define __NR_lsm_get_self_attr (__NR_Linux + 459)
|
||||
#define __NR_lsm_set_self_attr (__NR_Linux + 460)
|
||||
#define __NR_lsm_list_modules (__NR_Linux + 461)
|
||||
|
||||
#endif /* _ASM_UNISTD_O32_H */
|
||||
|
||||
@@ -438,6 +438,11 @@
|
||||
#define __NR_futex_wake 454
|
||||
#define __NR_futex_wait 455
|
||||
#define __NR_futex_requeue 456
|
||||
#define __NR_statmount 457
|
||||
#define __NR_listmount 458
|
||||
#define __NR_lsm_get_self_attr 459
|
||||
#define __NR_lsm_set_self_attr 460
|
||||
#define __NR_lsm_list_modules 461
|
||||
|
||||
|
||||
#endif /* _ASM_UNISTD_32_H */
|
||||
|
||||
@@ -410,6 +410,11 @@
|
||||
#define __NR_futex_wake 454
|
||||
#define __NR_futex_wait 455
|
||||
#define __NR_futex_requeue 456
|
||||
#define __NR_statmount 457
|
||||
#define __NR_listmount 458
|
||||
#define __NR_lsm_get_self_attr 459
|
||||
#define __NR_lsm_set_self_attr 460
|
||||
#define __NR_lsm_list_modules 461
|
||||
|
||||
|
||||
#endif /* _ASM_UNISTD_64_H */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user