mirror of https://github.com/xqemu/xqemu.git
ppc patch queue - 2015-10-23
sPAPR highlights: * Allow VFIO devices on the spapr-pci-host-bridge * Allow virtio VGA * Safer handling of HTAB allocation * ibm,pa-features device tree property non-sPAPR highlights: * Categorization of many ppc specific devices in help output * Tweaks to MMU type constants -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWKdNsAAoJEGw4ysog2bOSDxsQAKz5SLPmHhRztR8K0BMne0FP 5Yi3zFLAkWHCDA60BUaQPy2hh6jz+EVecxPecWb+nQ/jhQBBFjpkckgorjcHz6jQ 6pUHK1vZOPSq6bmb9/r+h5Po9pX7A2ncKX+wCJfwlceE7pNauDvJDQyKSXtwigPg IFsM+4TKrjwR7rVBHLoSKabM/2dGW0xxWpKII/xtuU6npfH15tdvadObjMfNLFcC gfTyggRMtuZwOCAxnyIZz+6tdNGqUbIV8zmzMHoWhpaPc3MBGQA4DrtOyWsWnLL3 VoIqOAVFzR7r2OAM610SZej1jn6Nl7wJtdFIq3NVXtMp/e3xzGjEK7CsVW14wjC3 pbVPwESe3fT91y7vyZVHLoSFlh9dOs+deNGCo58crJTq7gmeg4vDQwjn5Ec2Ch8P 92uZyuhsTGQ/m0xl2QAR29dcapTXytptJugVDUvxZw78UG3xY0DicBiW43cMh22/ JwIVtlmbSyIrL+SqO5j0ylCSPSn7BtE2EjHrcyAqHTM8c6cv4JFIN4p8ZYqqILVH LoRs6gGbrGey4QCVRDJc2w/pO21q0Xj+BIgZzcaZ8craKkCwarz5wYfJj7L8O4Hf tzHAl4HjHQ3AZr03ejOKy40Y3CNaAAcU9mTFOq72r6LuoPoenbUh7Sm9Bo9st1Z2 cUjqLvzaL2N04ppVEwsM =UrXv -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/dgibson/tags/ppc-next-20151023' into staging ppc patch queue - 2015-10-23 sPAPR highlights: * Allow VFIO devices on the spapr-pci-host-bridge * Allow virtio VGA * Safer handling of HTAB allocation * ibm,pa-features device tree property non-sPAPR highlights: * Categorization of many ppc specific devices in help output * Tweaks to MMU type constants # gpg: Signature made Fri 23 Oct 2015 07:27:56 BST using RSA key ID 20D9B392 # gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>" # gpg: aka "David Gibson (Red Hat) <dgibson@redhat.com>" # gpg: aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>" # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 75F4 6586 AE61 A66C C44E 87DC 6C38 CACA 20D9 B392 * remotes/dgibson/tags/ppc-next-20151023: (21 commits) prep: do not use CPU_LOG_IOPORT, convert to tracepoints openpic: add to misc category macio-nvram: add to misc category macio: add to bridge category uninorth: add to bridge category macio-ide: add to storage category cuda: add to bridge category grackle: add to bridge category escc: add to input category cmd646: add to storage category adb: add to input category ppc/spapr: Add "ibm,pa-features" property to the device-tree ppc: Add mmu_model defines for arch 2.03 and 2.07 hw/scsi/spapr_vscsi: Remove superfluous memset spapr_pci: Allow VFIO devices to work on the normal PCI host bridge spapr_iommu: Provide a function to switch a TCE table to allowing VFIO spapr_iommu: Rename vfio_accel parameter spapr_pci: Allow PCI host bridge DMA window to be configured spapr: Add "slb-size" property to CPU device tree nodes spapr: Abort when HTAB of requested size isn't allocated ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
147482ae35
|
@ -1035,6 +1035,7 @@ static void escc_class_init(ObjectClass *klass, void *data)
|
|||
dc->reset = escc_reset;
|
||||
dc->vmsd = &vmstate_escc;
|
||||
dc->props = escc_properties;
|
||||
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
|
||||
}
|
||||
|
||||
static const TypeInfo escc_info = {
|
||||
|
|
|
@ -417,6 +417,7 @@ static void cmd646_ide_class_init(ObjectClass *klass, void *data)
|
|||
k->config_read = cmd646_pci_config_read;
|
||||
k->config_write = cmd646_pci_config_write;
|
||||
dc->props = cmd646_ide_properties;
|
||||
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
|
||||
}
|
||||
|
||||
static const TypeInfo cmd646_ide_info = {
|
||||
|
|
|
@ -590,6 +590,7 @@ static void macio_ide_class_init(ObjectClass *oc, void *data)
|
|||
dc->realize = macio_ide_realizefn;
|
||||
dc->reset = macio_ide_reset;
|
||||
dc->vmsd = &vmstate_pmac;
|
||||
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
|
||||
}
|
||||
|
||||
static const TypeInfo macio_ide_type_info = {
|
||||
|
|
|
@ -362,6 +362,7 @@ static void adb_kbd_class_init(ObjectClass *oc, void *data)
|
|||
|
||||
akc->parent_realize = dc->realize;
|
||||
dc->realize = adb_kbd_realizefn;
|
||||
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
|
||||
|
||||
adc->devreq = adb_kbd_request;
|
||||
dc->reset = adb_kbd_reset;
|
||||
|
@ -566,6 +567,7 @@ static void adb_mouse_class_init(ObjectClass *oc, void *data)
|
|||
|
||||
amc->parent_realize = dc->realize;
|
||||
dc->realize = adb_mouse_realizefn;
|
||||
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
|
||||
|
||||
adc->devreq = adb_mouse_request;
|
||||
dc->reset = adb_mouse_reset;
|
||||
|
|
|
@ -1643,6 +1643,7 @@ static void openpic_class_init(ObjectClass *oc, void *data)
|
|||
dc->props = openpic_properties;
|
||||
dc->reset = openpic_reset;
|
||||
dc->vmsd = &vmstate_openpic;
|
||||
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
|
||||
}
|
||||
|
||||
static const TypeInfo openpic_info = {
|
||||
|
|
|
@ -275,6 +275,7 @@ static void kvm_openpic_class_init(ObjectClass *oc, void *data)
|
|||
dc->realize = kvm_openpic_realize;
|
||||
dc->props = kvm_openpic_properties;
|
||||
dc->reset = kvm_openpic_reset;
|
||||
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
|
||||
}
|
||||
|
||||
static const TypeInfo kvm_openpic_info = {
|
||||
|
|
|
@ -738,6 +738,7 @@ static void cuda_class_init(ObjectClass *oc, void *data)
|
|||
dc->reset = cuda_reset;
|
||||
dc->vmsd = &vmstate_cuda;
|
||||
dc->props = cuda_properties;
|
||||
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
|
||||
}
|
||||
|
||||
static const TypeInfo cuda_type_info = {
|
||||
|
|
|
@ -393,6 +393,7 @@ static void macio_class_init(ObjectClass *klass, void *data)
|
|||
k->vendor_id = PCI_VENDOR_ID_APPLE;
|
||||
k->class_id = PCI_CLASS_OTHERS << 8;
|
||||
dc->props = macio_properties;
|
||||
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
|
||||
}
|
||||
|
||||
static const TypeInfo macio_oldworld_type_info = {
|
||||
|
|
|
@ -123,6 +123,7 @@ static void macio_nvram_class_init(ObjectClass *oc, void *data)
|
|||
dc->reset = macio_nvram_reset;
|
||||
dc->vmsd = &vmstate_macio_nvram;
|
||||
dc->props = macio_nvram_properties;
|
||||
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
|
||||
}
|
||||
|
||||
static const TypeInfo macio_nvram_type_info = {
|
||||
|
|
|
@ -146,8 +146,10 @@ static const TypeInfo grackle_pci_info = {
|
|||
static void pci_grackle_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
|
||||
k->init = pci_grackle_init_device;
|
||||
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
|
||||
}
|
||||
|
||||
static const TypeInfo grackle_pci_host_info = {
|
||||
|
|
|
@ -446,8 +446,10 @@ static const TypeInfo unin_internal_pci_host_info = {
|
|||
static void pci_unin_main_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass);
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
|
||||
sbc->init = pci_unin_main_init_device;
|
||||
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
|
||||
}
|
||||
|
||||
static const TypeInfo pci_unin_main_info = {
|
||||
|
@ -460,8 +462,10 @@ static const TypeInfo pci_unin_main_info = {
|
|||
static void pci_u3_agp_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass);
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
|
||||
sbc->init = pci_u3_agp_init_device;
|
||||
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
|
||||
}
|
||||
|
||||
static const TypeInfo pci_u3_agp_info = {
|
||||
|
@ -474,8 +478,10 @@ static const TypeInfo pci_u3_agp_info = {
|
|||
static void pci_unin_agp_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass);
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
|
||||
sbc->init = pci_unin_agp_init_device;
|
||||
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
|
||||
}
|
||||
|
||||
static const TypeInfo pci_unin_agp_info = {
|
||||
|
@ -488,8 +494,10 @@ static const TypeInfo pci_unin_agp_info = {
|
|||
static void pci_unin_internal_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass);
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
|
||||
sbc->init = pci_unin_internal_init_device;
|
||||
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
|
||||
}
|
||||
|
||||
static const TypeInfo pci_unin_internal_info = {
|
||||
|
|
|
@ -42,11 +42,9 @@
|
|||
#include "sysemu/arch_init.h"
|
||||
#include "sysemu/qtest.h"
|
||||
#include "exec/address-spaces.h"
|
||||
#include "trace.h"
|
||||
#include "elf.h"
|
||||
|
||||
//#define HARD_DEBUG_PPC_IO
|
||||
//#define DEBUG_PPC_IO
|
||||
|
||||
/* SMP is not enabled, for now */
|
||||
#define MAX_CPUS 1
|
||||
|
||||
|
@ -57,26 +55,6 @@
|
|||
#define KERNEL_LOAD_ADDR 0x01000000
|
||||
#define INITRD_LOAD_ADDR 0x01800000
|
||||
|
||||
#if defined (HARD_DEBUG_PPC_IO) && !defined (DEBUG_PPC_IO)
|
||||
#define DEBUG_PPC_IO
|
||||
#endif
|
||||
|
||||
#if defined (HARD_DEBUG_PPC_IO)
|
||||
#define PPC_IO_DPRINTF(fmt, ...) \
|
||||
do { \
|
||||
if (qemu_loglevel_mask(CPU_LOG_IOPORT)) { \
|
||||
qemu_log("%s: " fmt, __func__ , ## __VA_ARGS__); \
|
||||
} else { \
|
||||
printf("%s : " fmt, __func__ , ## __VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
#elif defined (DEBUG_PPC_IO)
|
||||
#define PPC_IO_DPRINTF(fmt, ...) \
|
||||
qemu_log_mask(CPU_LOG_IOPORT, fmt, ## __VA_ARGS__)
|
||||
#else
|
||||
#define PPC_IO_DPRINTF(fmt, ...) do { } while (0)
|
||||
#endif
|
||||
|
||||
/* Constants for devices init */
|
||||
static const int ide_iobase[2] = { 0x1f0, 0x170 };
|
||||
static const int ide_iobase2[2] = { 0x3f6, 0x376 };
|
||||
|
@ -199,8 +177,7 @@ static void PREP_io_800_writeb (void *opaque, uint32_t addr, uint32_t val)
|
|||
{
|
||||
sysctrl_t *sysctrl = opaque;
|
||||
|
||||
PPC_IO_DPRINTF("0x%08" PRIx32 " => 0x%02" PRIx32 "\n",
|
||||
addr - PPC_IO_BASE, val);
|
||||
trace_prep_io_800_writeb(addr - PPC_IO_BASE, val);
|
||||
switch (addr) {
|
||||
case 0x0092:
|
||||
/* Special port 92 */
|
||||
|
@ -327,8 +304,7 @@ static uint32_t PREP_io_800_readb (void *opaque, uint32_t addr)
|
|||
printf("ERROR: unaffected IO port: %04" PRIx32 " read\n", addr);
|
||||
break;
|
||||
}
|
||||
PPC_IO_DPRINTF("0x%08" PRIx32 " <= 0x%02" PRIx32 "\n",
|
||||
addr - PPC_IO_BASE, retval);
|
||||
trace_prep_io_800_readb(addr - PPC_IO_BASE, retval);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -597,6 +597,24 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset,
|
|||
uint32_t vcpus_per_socket = smp_threads * smp_cores;
|
||||
uint32_t pft_size_prop[] = {0, cpu_to_be32(spapr->htab_shift)};
|
||||
|
||||
/* Note: we keep CI large pages off for now because a 64K capable guest
|
||||
* provisioned with large pages might otherwise try to map a qemu
|
||||
* framebuffer (or other kind of memory mapped PCI BAR) using 64K pages
|
||||
* even if that qemu runs on a 4k host.
|
||||
*
|
||||
* We can later add this bit back when we are confident this is not
|
||||
* an issue (!HV KVM or 64K host)
|
||||
*/
|
||||
uint8_t pa_features_206[] = { 6, 0,
|
||||
0xf6, 0x1f, 0xc7, 0x00, 0x80, 0xc0 };
|
||||
uint8_t pa_features_207[] = { 24, 0,
|
||||
0xf6, 0x1f, 0xc7, 0xc0, 0x80, 0xf0,
|
||||
0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x80, 0x00,
|
||||
0x80, 0x00, 0x80, 0x00, 0x80, 0x00 };
|
||||
uint8_t *pa_features;
|
||||
size_t pa_size;
|
||||
|
||||
_FDT((fdt_setprop_cell(fdt, offset, "reg", index)));
|
||||
_FDT((fdt_setprop_string(fdt, offset, "device_type", "cpu")));
|
||||
|
||||
|
@ -625,6 +643,7 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset,
|
|||
|
||||
_FDT((fdt_setprop_cell(fdt, offset, "timebase-frequency", tbfreq)));
|
||||
_FDT((fdt_setprop_cell(fdt, offset, "clock-frequency", cpufreq)));
|
||||
_FDT((fdt_setprop_cell(fdt, offset, "slb-size", env->slb_nr)));
|
||||
_FDT((fdt_setprop_cell(fdt, offset, "ibm,slb-size", env->slb_nr)));
|
||||
_FDT((fdt_setprop_string(fdt, offset, "status", "okay")));
|
||||
_FDT((fdt_setprop(fdt, offset, "64-bit", NULL, 0)));
|
||||
|
@ -662,6 +681,19 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset,
|
|||
page_sizes_prop, page_sizes_prop_size)));
|
||||
}
|
||||
|
||||
/* Do the ibm,pa-features property, adjust it for ci-large-pages */
|
||||
if (env->mmu_model == POWERPC_MMU_2_06) {
|
||||
pa_features = pa_features_206;
|
||||
pa_size = sizeof(pa_features_206);
|
||||
} else /* env->mmu_model == POWERPC_MMU_2_07 */ {
|
||||
pa_features = pa_features_207;
|
||||
pa_size = sizeof(pa_features_207);
|
||||
}
|
||||
if (env->ci_large_pages) {
|
||||
pa_features[3] |= 0x20;
|
||||
}
|
||||
_FDT((fdt_setprop(fdt, offset, "ibm,pa-features", pa_features, pa_size)));
|
||||
|
||||
_FDT((fdt_setprop_cell(fdt, offset, "ibm,chip-id",
|
||||
cs->cpu_index / vcpus_per_socket)));
|
||||
|
||||
|
@ -979,7 +1011,7 @@ static void emulate_spapr_hypercall(PowerPCCPU *cpu)
|
|||
#define CLEAN_HPTE(_hpte) ((*(uint64_t *)(_hpte)) &= tswap64(~HPTE64_V_HPTE_DIRTY))
|
||||
#define DIRTY_HPTE(_hpte) ((*(uint64_t *)(_hpte)) |= tswap64(HPTE64_V_HPTE_DIRTY))
|
||||
|
||||
static void spapr_reset_htab(sPAPRMachineState *spapr)
|
||||
static void spapr_alloc_htab(sPAPRMachineState *spapr)
|
||||
{
|
||||
long shift;
|
||||
int index;
|
||||
|
@ -992,20 +1024,47 @@ static void spapr_reset_htab(sPAPRMachineState *spapr)
|
|||
|
||||
if (shift > 0) {
|
||||
/* Kernel handles htab, we don't need to allocate one */
|
||||
if (shift != spapr->htab_shift) {
|
||||
error_setg(&error_abort, "Failed to allocate HTAB of requested size, try with smaller maxmem");
|
||||
}
|
||||
|
||||
spapr->htab_shift = shift;
|
||||
kvmppc_kern_htab = true;
|
||||
} else {
|
||||
/* Allocate htab */
|
||||
spapr->htab = qemu_memalign(HTAB_SIZE(spapr), HTAB_SIZE(spapr));
|
||||
|
||||
/* And clear it */
|
||||
memset(spapr->htab, 0, HTAB_SIZE(spapr));
|
||||
|
||||
for (index = 0; index < HTAB_SIZE(spapr) / HASH_PTE_SIZE_64; index++) {
|
||||
DIRTY_HPTE(HPTE(spapr->htab, index));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear HTAB entries during reset.
|
||||
*
|
||||
* If host kernel has allocated HTAB, KVM_PPC_ALLOCATE_HTAB ioctl is
|
||||
* used to clear HTAB. Otherwise QEMU-allocated HTAB is cleared manually.
|
||||
*/
|
||||
static void spapr_reset_htab(sPAPRMachineState *spapr)
|
||||
{
|
||||
long shift;
|
||||
int index;
|
||||
|
||||
shift = kvmppc_reset_htab(spapr->htab_shift);
|
||||
if (shift > 0) {
|
||||
if (shift != spapr->htab_shift) {
|
||||
error_setg(&error_abort, "Requested HTAB allocation failed during reset");
|
||||
}
|
||||
|
||||
/* Tell readers to update their file descriptor */
|
||||
if (spapr->htab_fd >= 0) {
|
||||
spapr->htab_fd_stale = true;
|
||||
}
|
||||
} else {
|
||||
if (!spapr->htab) {
|
||||
/* Allocate an htab if we don't yet have one */
|
||||
spapr->htab = qemu_memalign(HTAB_SIZE(spapr), HTAB_SIZE(spapr));
|
||||
}
|
||||
|
||||
/* And clear it */
|
||||
memset(spapr->htab, 0, HTAB_SIZE(spapr));
|
||||
|
||||
for (index = 0; index < HTAB_SIZE(spapr) / HASH_PTE_SIZE_64; index++) {
|
||||
|
@ -1710,6 +1769,7 @@ static void ppc_spapr_init(MachineState *machine)
|
|||
}
|
||||
spapr->htab_shift++;
|
||||
}
|
||||
spapr_alloc_htab(spapr);
|
||||
|
||||
/* Set up Interrupt Controller before we create the VCPUs */
|
||||
spapr->icp = xics_system_init(machine,
|
||||
|
|
|
@ -146,7 +146,7 @@ static int spapr_tce_table_realize(DeviceState *dev)
|
|||
tcet->table = kvmppc_create_spapr_tce(tcet->liobn,
|
||||
window_size,
|
||||
&tcet->fd,
|
||||
tcet->vfio_accel);
|
||||
tcet->need_vfio);
|
||||
}
|
||||
|
||||
if (!tcet->table) {
|
||||
|
@ -168,11 +168,43 @@ static int spapr_tce_table_realize(DeviceState *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void spapr_tce_set_need_vfio(sPAPRTCETable *tcet, bool need_vfio)
|
||||
{
|
||||
size_t table_size = tcet->nb_table * sizeof(uint64_t);
|
||||
void *newtable;
|
||||
|
||||
if (need_vfio == tcet->need_vfio) {
|
||||
/* Nothing to do */
|
||||
return;
|
||||
}
|
||||
|
||||
if (!need_vfio) {
|
||||
/* FIXME: We don't support transition back to KVM accelerated
|
||||
* TCEs yet */
|
||||
return;
|
||||
}
|
||||
|
||||
tcet->need_vfio = true;
|
||||
|
||||
if (tcet->fd < 0) {
|
||||
/* Table is already in userspace, nothing to be do */
|
||||
return;
|
||||
}
|
||||
|
||||
newtable = g_malloc(table_size);
|
||||
memcpy(newtable, tcet->table, table_size);
|
||||
|
||||
kvmppc_remove_spapr_tce(tcet->table, tcet->fd, tcet->nb_table);
|
||||
|
||||
tcet->fd = -1;
|
||||
tcet->table = newtable;
|
||||
}
|
||||
|
||||
sPAPRTCETable *spapr_tce_new_table(DeviceState *owner, uint32_t liobn,
|
||||
uint64_t bus_offset,
|
||||
uint32_t page_shift,
|
||||
uint32_t nb_table,
|
||||
bool vfio_accel)
|
||||
bool need_vfio)
|
||||
{
|
||||
sPAPRTCETable *tcet;
|
||||
char tmp[64];
|
||||
|
@ -192,7 +224,7 @@ sPAPRTCETable *spapr_tce_new_table(DeviceState *owner, uint32_t liobn,
|
|||
tcet->bus_offset = bus_offset;
|
||||
tcet->page_shift = page_shift;
|
||||
tcet->nb_table = nb_table;
|
||||
tcet->vfio_accel = vfio_accel;
|
||||
tcet->need_vfio = need_vfio;
|
||||
|
||||
snprintf(tmp, sizeof(tmp), "tce-table-%x", liobn);
|
||||
object_property_add_child(OBJECT(owner), tmp, OBJECT(tcet), NULL);
|
||||
|
|
|
@ -1083,6 +1083,12 @@ static void spapr_phb_add_pci_device(sPAPRDRConnector *drc,
|
|||
void *fdt = NULL;
|
||||
int fdt_start_offset = 0, fdt_size;
|
||||
|
||||
if (object_dynamic_cast(OBJECT(pdev), "vfio-pci")) {
|
||||
sPAPRTCETable *tcet = spapr_tce_find_by_liobn(phb->dma_liobn);
|
||||
|
||||
spapr_tce_set_need_vfio(tcet, true);
|
||||
}
|
||||
|
||||
if (dev->hotplugged) {
|
||||
fdt = create_device_tree(&fdt_size);
|
||||
fdt_start_offset = spapr_create_pci_child_dt(phb, pdev, fdt, 0);
|
||||
|
@ -1387,7 +1393,7 @@ static void spapr_phb_finish_realize(sPAPRPHBState *sphb, Error **errp)
|
|||
sPAPRTCETable *tcet;
|
||||
uint32_t nb_table;
|
||||
|
||||
nb_table = SPAPR_PCI_DMA32_SIZE >> SPAPR_TCE_PAGE_SHIFT;
|
||||
nb_table = sphb->dma_win_size >> SPAPR_TCE_PAGE_SHIFT;
|
||||
tcet = spapr_tce_new_table(DEVICE(sphb), sphb->dma_liobn,
|
||||
0, SPAPR_TCE_PAGE_SHIFT, nb_table, false);
|
||||
if (!tcet) {
|
||||
|
@ -1397,7 +1403,7 @@ static void spapr_phb_finish_realize(sPAPRPHBState *sphb, Error **errp)
|
|||
}
|
||||
|
||||
/* Register default 32bit DMA window */
|
||||
memory_region_add_subregion(&sphb->iommu_root, 0,
|
||||
memory_region_add_subregion(&sphb->iommu_root, sphb->dma_win_addr,
|
||||
spapr_tce_get_iommu(tcet));
|
||||
}
|
||||
|
||||
|
@ -1430,6 +1436,9 @@ static Property spapr_phb_properties[] = {
|
|||
SPAPR_PCI_IO_WIN_SIZE),
|
||||
DEFINE_PROP_BOOL("dynamic-reconfiguration", sPAPRPHBState, dr_enabled,
|
||||
true),
|
||||
/* Default DMA window is 0..1GB */
|
||||
DEFINE_PROP_UINT64("dma_win_addr", sPAPRPHBState, dma_win_addr, 0),
|
||||
DEFINE_PROP_UINT64("dma_win_size", sPAPRPHBState, dma_win_size, 0x40000000),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
|
|
|
@ -750,7 +750,6 @@ static void vscsi_report_luns(VSCSIState *s, vscsi_req *req)
|
|||
len = n+8;
|
||||
|
||||
resp_data = g_malloc0(len);
|
||||
memset(resp_data, 0, len);
|
||||
stl_be_p(resp_data, n);
|
||||
i = found_lun0 ? 8 : 16;
|
||||
QTAILQ_FOREACH(kid, &s->bus.qbus.children, sibling) {
|
||||
|
|
|
@ -78,6 +78,7 @@ struct sPAPRPHBState {
|
|||
MemoryRegion memwindow, iowindow, msiwindow;
|
||||
|
||||
uint32_t dma_liobn;
|
||||
hwaddr dma_win_addr, dma_win_size;
|
||||
AddressSpace iommu_as;
|
||||
MemoryRegion iommu_root;
|
||||
|
||||
|
@ -115,8 +116,6 @@ struct sPAPRPHBVFIOState {
|
|||
|
||||
#define SPAPR_PCI_MSI_WINDOW 0x40000000000ULL
|
||||
|
||||
#define SPAPR_PCI_DMA32_SIZE 0x40000000
|
||||
|
||||
static inline qemu_irq spapr_phb_lsi_qirq(struct sPAPRPHBState *phb, int pin)
|
||||
{
|
||||
sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
|
||||
|
|
|
@ -563,7 +563,7 @@ struct sPAPRTCETable {
|
|||
uint32_t page_shift;
|
||||
uint64_t *table;
|
||||
bool bypass;
|
||||
bool vfio_accel;
|
||||
bool need_vfio;
|
||||
int fd;
|
||||
MemoryRegion iommu;
|
||||
struct VIOsPAPRDevice *vdev; /* for @bypass migration compatibility only */
|
||||
|
@ -588,7 +588,9 @@ sPAPRTCETable *spapr_tce_new_table(DeviceState *owner, uint32_t liobn,
|
|||
uint64_t bus_offset,
|
||||
uint32_t page_shift,
|
||||
uint32_t nb_table,
|
||||
bool vfio_accel);
|
||||
bool need_vfio);
|
||||
void spapr_tce_set_need_vfio(sPAPRTCETable *tcet, bool need_vfio);
|
||||
|
||||
MemoryRegion *spapr_tce_get_iommu(sPAPRTCETable *tcet);
|
||||
int spapr_dma_dt(void *fdt, int node_off, const char *propname,
|
||||
uint32_t liobn, uint64_t window, uint32_t size);
|
||||
|
|
|
@ -117,14 +117,14 @@ enum powerpc_mmu_t {
|
|||
#define POWERPC_MMU_AMR 0x00040000
|
||||
/* 64 bits PowerPC MMU */
|
||||
POWERPC_MMU_64B = POWERPC_MMU_64 | 0x00000001,
|
||||
/* Architecture 2.03 and later (has LPCR) */
|
||||
POWERPC_MMU_2_03 = POWERPC_MMU_64 | 0x00000002,
|
||||
/* Architecture 2.06 variant */
|
||||
POWERPC_MMU_2_06 = POWERPC_MMU_64 | POWERPC_MMU_1TSEG
|
||||
| POWERPC_MMU_AMR | 0x00000003,
|
||||
/* Architecture 2.06 "degraded" (no 1T segments) */
|
||||
POWERPC_MMU_2_06a = POWERPC_MMU_64 | POWERPC_MMU_AMR
|
||||
| 0x00000003,
|
||||
/* Architecture 2.06 "degraded" (no 1T segments or AMR) */
|
||||
POWERPC_MMU_2_06d = POWERPC_MMU_64 | 0x00000003,
|
||||
/* Architecture 2.07 variant */
|
||||
POWERPC_MMU_2_07 = POWERPC_MMU_64 | POWERPC_MMU_1TSEG
|
||||
| POWERPC_MMU_AMR | 0x00000004,
|
||||
#endif /* defined(TARGET_PPC64) */
|
||||
};
|
||||
|
||||
|
@ -1073,6 +1073,7 @@ struct CPUPPCState {
|
|||
uint64_t insns_flags2;
|
||||
#if defined(TARGET_PPC64)
|
||||
struct ppc_segment_page_sizes sps;
|
||||
bool ci_large_pages;
|
||||
#endif
|
||||
|
||||
#if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
|
||||
|
|
|
@ -259,7 +259,8 @@ static void kvm_get_fallback_smmu_info(PowerPCCPU *cpu,
|
|||
info->flags |= KVM_PPC_1T_SEGMENTS;
|
||||
}
|
||||
|
||||
if (env->mmu_model == POWERPC_MMU_2_06) {
|
||||
if (env->mmu_model == POWERPC_MMU_2_06 ||
|
||||
env->mmu_model == POWERPC_MMU_2_07) {
|
||||
info->slb_size = 32;
|
||||
} else {
|
||||
info->slb_size = 64;
|
||||
|
@ -272,8 +273,9 @@ static void kvm_get_fallback_smmu_info(PowerPCCPU *cpu,
|
|||
info->sps[i].enc[0].pte_enc = 0;
|
||||
i++;
|
||||
|
||||
/* 64K on MMU 2.06 */
|
||||
if (env->mmu_model == POWERPC_MMU_2_06) {
|
||||
/* 64K on MMU 2.06 and later */
|
||||
if (env->mmu_model == POWERPC_MMU_2_06 ||
|
||||
env->mmu_model == POWERPC_MMU_2_07) {
|
||||
info->sps[i].page_shift = 16;
|
||||
info->sps[i].slb_enc = 0x110;
|
||||
info->sps[i].enc[0].page_shift = 16;
|
||||
|
@ -412,6 +414,13 @@ static void kvm_fixup_page_sizes(PowerPCCPU *cpu)
|
|||
/* Convert to QEMU form */
|
||||
memset(&env->sps, 0, sizeof(env->sps));
|
||||
|
||||
/* If we have HV KVM, we need to forbid CI large pages if our
|
||||
* host page size is smaller than 64K.
|
||||
*/
|
||||
if (smmu_info.flags & KVM_PPC_PAGE_SIZES_REAL) {
|
||||
env->ci_large_pages = getpagesize() >= 0x10000;
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX This loop should be an entry wide AND of the capabilities that
|
||||
* the selected CPU has with the capabilities that KVM supports.
|
||||
|
@ -2070,7 +2079,7 @@ bool kvmppc_spapr_use_multitce(void)
|
|||
}
|
||||
|
||||
void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd,
|
||||
bool vfio_accel)
|
||||
bool need_vfio)
|
||||
{
|
||||
struct kvm_create_spapr_tce args = {
|
||||
.liobn = liobn,
|
||||
|
@ -2084,7 +2093,7 @@ void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd,
|
|||
* destroying the table, which the upper layers -will- do
|
||||
*/
|
||||
*pfd = -1;
|
||||
if (!cap_spapr_tce || (vfio_accel && !cap_spapr_vfio)) {
|
||||
if (!cap_spapr_tce || (need_vfio && !cap_spapr_vfio)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ int kvmppc_booke_watchdog_enable(PowerPCCPU *cpu);
|
|||
off_t kvmppc_alloc_rma(void **rma);
|
||||
bool kvmppc_spapr_use_multitce(void);
|
||||
void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd,
|
||||
bool vfio_accel);
|
||||
bool need_vfio);
|
||||
int kvmppc_remove_spapr_tce(void *table, int pfd, uint32_t window_size);
|
||||
int kvmppc_reset_htab(int shift_hint);
|
||||
uint64_t kvmppc_rma_size(uint64_t current_size, unsigned int hash_shift);
|
||||
|
|
|
@ -1293,9 +1293,9 @@ void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUPPCState *env)
|
|||
break;
|
||||
#if defined(TARGET_PPC64)
|
||||
case POWERPC_MMU_64B:
|
||||
case POWERPC_MMU_2_03:
|
||||
case POWERPC_MMU_2_06:
|
||||
case POWERPC_MMU_2_06a:
|
||||
case POWERPC_MMU_2_06d:
|
||||
case POWERPC_MMU_2_07:
|
||||
dump_slb(f, cpu_fprintf, env);
|
||||
break;
|
||||
#endif
|
||||
|
@ -1433,9 +1433,9 @@ hwaddr ppc_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
|
|||
switch (env->mmu_model) {
|
||||
#if defined(TARGET_PPC64)
|
||||
case POWERPC_MMU_64B:
|
||||
case POWERPC_MMU_2_03:
|
||||
case POWERPC_MMU_2_06:
|
||||
case POWERPC_MMU_2_06a:
|
||||
case POWERPC_MMU_2_06d:
|
||||
case POWERPC_MMU_2_07:
|
||||
return ppc_hash64_get_phys_page_debug(env, addr);
|
||||
#endif
|
||||
|
||||
|
@ -1937,9 +1937,9 @@ void ppc_tlb_invalidate_all(CPUPPCState *env)
|
|||
case POWERPC_MMU_601:
|
||||
#if defined(TARGET_PPC64)
|
||||
case POWERPC_MMU_64B:
|
||||
case POWERPC_MMU_2_03:
|
||||
case POWERPC_MMU_2_06:
|
||||
case POWERPC_MMU_2_06a:
|
||||
case POWERPC_MMU_2_06d:
|
||||
case POWERPC_MMU_2_07:
|
||||
#endif /* defined(TARGET_PPC64) */
|
||||
tlb_flush(CPU(cpu), 1);
|
||||
break;
|
||||
|
@ -2011,9 +2011,9 @@ void ppc_tlb_invalidate_one(CPUPPCState *env, target_ulong addr)
|
|||
break;
|
||||
#if defined(TARGET_PPC64)
|
||||
case POWERPC_MMU_64B:
|
||||
case POWERPC_MMU_2_03:
|
||||
case POWERPC_MMU_2_06:
|
||||
case POWERPC_MMU_2_06a:
|
||||
case POWERPC_MMU_2_06d:
|
||||
case POWERPC_MMU_2_07:
|
||||
/* tlbie invalidate TLBs for all segments */
|
||||
/* XXX: given the fact that there are too many segments to invalidate,
|
||||
* and we still don't have a tlb_flush_mask(env, n, mask) in QEMU,
|
||||
|
|
|
@ -11327,9 +11327,9 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
|
|||
case POWERPC_MMU_SOFT_74xx:
|
||||
#if defined(TARGET_PPC64)
|
||||
case POWERPC_MMU_64B:
|
||||
case POWERPC_MMU_2_03:
|
||||
case POWERPC_MMU_2_06:
|
||||
case POWERPC_MMU_2_06a:
|
||||
case POWERPC_MMU_2_06d:
|
||||
case POWERPC_MMU_2_07:
|
||||
#endif
|
||||
cpu_fprintf(f, " SDR1 " TARGET_FMT_lx " DAR " TARGET_FMT_lx
|
||||
" DSISR " TARGET_FMT_lx "\n", env->spr[SPR_SDR1],
|
||||
|
|
|
@ -7864,6 +7864,7 @@ static void init_proc_book3s_64(CPUPPCState *env, int version)
|
|||
gen_spr_book3s_ids(env);
|
||||
gen_spr_amr(env);
|
||||
gen_spr_book3s_purr(env);
|
||||
env->ci_large_pages = true;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
|
@ -8019,7 +8020,7 @@ POWERPC_FAMILY(POWER5P)(ObjectClass *oc, void *data)
|
|||
(1ull << MSR_DR) |
|
||||
(1ull << MSR_PMM) |
|
||||
(1ull << MSR_RI);
|
||||
pcc->mmu_model = POWERPC_MMU_64B;
|
||||
pcc->mmu_model = POWERPC_MMU_2_03;
|
||||
#if defined(CONFIG_SOFTMMU)
|
||||
pcc->handle_mmu_fault = ppc_hash64_handle_mmu_fault;
|
||||
#endif
|
||||
|
@ -8243,7 +8244,7 @@ POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data)
|
|||
(1ull << MSR_PMM) |
|
||||
(1ull << MSR_RI) |
|
||||
(1ull << MSR_LE);
|
||||
pcc->mmu_model = POWERPC_MMU_2_06;
|
||||
pcc->mmu_model = POWERPC_MMU_2_07;
|
||||
#if defined(CONFIG_SOFTMMU)
|
||||
pcc->handle_mmu_fault = ppc_hash64_handle_mmu_fault;
|
||||
#endif
|
||||
|
|
|
@ -1383,6 +1383,10 @@ spapr_iommu_new_table(uint64_t liobn, void *tcet, void *table, int fd) "liobn=%"
|
|||
# hw/ppc/ppc.c
|
||||
ppc_tb_adjust(uint64_t offs1, uint64_t offs2, int64_t diff, int64_t seconds) "adjusted from 0x%"PRIx64" to 0x%"PRIx64", diff %"PRId64" (%"PRId64"s)"
|
||||
|
||||
# hw/ppc/prep.c
|
||||
prep_io_800_writeb(uint32_t addr, uint32_t val) "0x%08" PRIx32 " => 0x%02" PRIx32
|
||||
prep_io_800_readb(uint32_t addr, uint32_t retval) "0x%08" PRIx32 " <= 0x%02" PRIx32
|
||||
|
||||
# util/hbitmap.c
|
||||
hbitmap_iter_skip_words(const void *hb, void *hbi, uint64_t pos, unsigned long cur) "hb %p hbi %p pos %"PRId64" cur 0x%lx"
|
||||
hbitmap_reset(void *hb, uint64_t start, uint64_t count, uint64_t sbit, uint64_t ebit) "hb %p items %"PRIu64",%"PRIu64" bits %"PRIu64"..%"PRIu64
|
||||
|
|
Loading…
Reference in New Issue