s390x fixes:
- fix propagation and reset for the new diag318 call - fix hot-unplug for vfio-pci devices - fix endianness issues in zPCI (regression fix) -----BEGIN PGP SIGNATURE----- iQJGBAABCAAwFiEEw9DWbcNiT/aowBjO3s9rk8bwL68FAl+2Rd4SHGNvaHVja0By ZWRoYXQuY29tAAoJEN7Pa5PG8C+vu78P/1JQjFRdtbT5tKsO1/BXBsO+s4++9LSL 1pvo+FerMWrZhiHxtlQQWPWkRBVUxrz9pSM1rzJfYzTjITLp6uQROQmUz8UKE9d4 fGrmqai6S5S8/3F2D0+/Yg8BU+j1Cn56mQ9bO4f1YSVIrj0nYCll9jv29TEcCD/g CQQE9WPH6PEY1VJqM4IDU2b51CWfDUwC/N6iBXmexMpEioq7LeLJ2WfE3j+0q4p+ BmJK6mVLNKqhQLXiZIBbs3b9kzLmzlLhbLuax5asRR/3e5CUBY7cDXGxQq/ERfed 5Kotv0wxeHYQ93F1oe+liGjG+dpLIkBAonSYOWP1QJnz6okr23nVX6vd3TrGLQD2 iF0Y7YYC4qaGMlEyUszP3dzt15s0cmaBPlBZuqbekeOWMrUuWT0oI7T8lWQeq3Xe O23JabhRSpN1kVmP/eu4UDXFIwUdHJL9e7rKUqwnduJEILMl0FbL0X6Wu62viEAv 4h3S71XkxMVWHDQs2JcUi60SFlUWRBjshwChqKAFW7KZ6I6gfN+V8MOjlRSeDxkl KVTbnLkdT0ejFdvM6KbrGHX9b04edHeTN1xxU7Il26WzFboPTrPI7jTD0qp29Rjz Hq67TtJGq7Y9QCMIyQthVfAJFK+6Z6myM0jkfWZHvZHllbRSCmpAPMQy/p2hC89X E3cIsHNzs0WT =WD4X -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20201119' into staging s390x fixes: - fix propagation and reset for the new diag318 call - fix hot-unplug for vfio-pci devices - fix endianness issues in zPCI (regression fix) # gpg: Signature made Thu 19 Nov 2020 10:15:58 GMT # gpg: using RSA key C3D0D66DC3624FF6A8C018CEDECF6B93C6F02FAF # gpg: issuer "cohuck@redhat.com" # gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>" [unknown] # gpg: aka "Cornelia Huck <huckc@linux.vnet.ibm.com>" [full] # gpg: aka "Cornelia Huck <cornelia.huck@de.ibm.com>" [full] # gpg: aka "Cornelia Huck <cohuck@kernel.org>" [unknown] # gpg: aka "Cornelia Huck <cohuck@redhat.com>" [unknown] # Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0 18CE DECF 6B93 C6F0 2FAF * remotes/cohuck/tags/s390x-20201119: s390x/pci: fix endianness issues s390x/pci: Unregister listeners before destroying IOMMU address space s390/kvm: fix diag318 propagation and reset functionality Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
ff85db769f
|
@ -732,6 +732,13 @@ static void s390_pci_iommu_free(S390pciState *s, PCIBus *bus, int32_t devfn)
|
|||
|
||||
table->iommu[PCI_SLOT(devfn)] = NULL;
|
||||
g_hash_table_destroy(iommu->iotlb);
|
||||
/*
|
||||
* An attached PCI device may have memory listeners, eg. VFIO PCI.
|
||||
* The associated subregion will already have been unmapped in
|
||||
* s390_pci_iommu_disable in response to the guest deconfigure request.
|
||||
* Remove the listeners now before destroying the address space.
|
||||
*/
|
||||
address_space_remove_listeners(&iommu->as);
|
||||
address_space_destroy(&iommu->as);
|
||||
object_unparent(OBJECT(&iommu->mr));
|
||||
object_unparent(OBJECT(iommu));
|
||||
|
@ -770,11 +777,11 @@ static void s390_pci_init_default_group(void)
|
|||
group = s390_group_create(ZPCI_DEFAULT_FN_GRP);
|
||||
resgrp = &group->zpci_group;
|
||||
resgrp->fr = 1;
|
||||
stq_p(&resgrp->dasm, 0);
|
||||
stq_p(&resgrp->msia, ZPCI_MSI_ADDR);
|
||||
stw_p(&resgrp->mui, DEFAULT_MUI);
|
||||
stw_p(&resgrp->i, 128);
|
||||
stw_p(&resgrp->maxstbl, 128);
|
||||
resgrp->dasm = 0;
|
||||
resgrp->msia = ZPCI_MSI_ADDR;
|
||||
resgrp->mui = DEFAULT_MUI;
|
||||
resgrp->i = 128;
|
||||
resgrp->maxstbl = 128;
|
||||
resgrp->version = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -281,7 +281,13 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra)
|
|||
goto out;
|
||||
}
|
||||
|
||||
memcpy(resquery, &pbdev->zpci_fn, sizeof(*resquery));
|
||||
stq_p(&resquery->sdma, pbdev->zpci_fn.sdma);
|
||||
stq_p(&resquery->edma, pbdev->zpci_fn.edma);
|
||||
stw_p(&resquery->pchid, pbdev->zpci_fn.pchid);
|
||||
resquery->flags = pbdev->zpci_fn.flags;
|
||||
resquery->pfgid = pbdev->zpci_fn.pfgid;
|
||||
stl_p(&resquery->fid, pbdev->zpci_fn.fid);
|
||||
stl_p(&resquery->uid, pbdev->zpci_fn.uid);
|
||||
|
||||
for (i = 0; i < PCI_BAR_COUNT; i++) {
|
||||
uint32_t data = pci_get_long(pbdev->pdev->config +
|
||||
|
@ -312,7 +318,13 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra)
|
|||
stw_p(&resgrp->hdr.rsp, CLP_RC_QUERYPCIFG_PFGID);
|
||||
goto out;
|
||||
}
|
||||
memcpy(resgrp, &group->zpci_group, sizeof(ClpRspQueryPciGrp));
|
||||
resgrp->fr = group->zpci_group.fr;
|
||||
stq_p(&resgrp->dasm, group->zpci_group.dasm);
|
||||
stq_p(&resgrp->msia, group->zpci_group.msia);
|
||||
stw_p(&resgrp->mui, group->zpci_group.mui);
|
||||
stw_p(&resgrp->i, group->zpci_group.i);
|
||||
stw_p(&resgrp->maxstbl, group->zpci_group.maxstbl);
|
||||
resgrp->version = group->zpci_group.version;
|
||||
stw_p(&resgrp->hdr.rsp, CLP_RC_OK);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -156,12 +156,12 @@ static void s390_pci_read_group(S390PCIBusDevice *pbdev,
|
|||
if (cap->flags & VFIO_DEVICE_INFO_ZPCI_FLAG_REFRESH) {
|
||||
resgrp->fr = 1;
|
||||
}
|
||||
stq_p(&resgrp->dasm, cap->dasm);
|
||||
stq_p(&resgrp->msia, cap->msi_addr);
|
||||
stw_p(&resgrp->mui, cap->mui);
|
||||
stw_p(&resgrp->i, cap->noi);
|
||||
stw_p(&resgrp->maxstbl, cap->maxstbl);
|
||||
stb_p(&resgrp->version, cap->version);
|
||||
resgrp->dasm = cap->dasm;
|
||||
resgrp->msia = cap->msi_addr;
|
||||
resgrp->mui = cap->mui;
|
||||
resgrp->i = cap->noi;
|
||||
resgrp->maxstbl = cap->maxstbl;
|
||||
resgrp->version = cap->version;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -486,6 +486,10 @@ static void s390_machine_reset(MachineState *machine)
|
|||
default:
|
||||
g_assert_not_reached();
|
||||
}
|
||||
|
||||
CPU_FOREACH(t) {
|
||||
run_on_cpu(t, s390_do_cpu_set_diag318, RUN_ON_CPU_HOST_ULONG(0));
|
||||
}
|
||||
s390_ipl_clear_reset_request();
|
||||
}
|
||||
|
||||
|
|
|
@ -144,10 +144,10 @@ typedef struct ClpReqQueryPciGrp {
|
|||
ClpReqHdr hdr;
|
||||
uint32_t fmt;
|
||||
uint64_t reserved1;
|
||||
#define CLP_REQ_QPCIG_MASK_PFGID 0xff
|
||||
uint32_t g;
|
||||
uint32_t reserved2;
|
||||
uint64_t reserved3;
|
||||
uint8_t reserved2[3];
|
||||
uint8_t g;
|
||||
uint32_t reserved3;
|
||||
uint64_t reserved4;
|
||||
} QEMU_PACKED ClpReqQueryPciGrp;
|
||||
|
||||
/* Query PCI function group response */
|
||||
|
|
|
@ -447,6 +447,13 @@ void s390_enable_css_support(S390CPU *cpu)
|
|||
kvm_s390_enable_css_support(cpu);
|
||||
}
|
||||
}
|
||||
|
||||
void s390_do_cpu_set_diag318(CPUState *cs, run_on_cpu_data arg)
|
||||
{
|
||||
if (kvm_enabled()) {
|
||||
kvm_s390_set_diag318(cs, arg.host_ulong);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static gchar *s390_gdb_arch_name(CPUState *cs)
|
||||
|
|
|
@ -769,6 +769,7 @@ int s390_set_memory_limit(uint64_t new_limit, uint64_t *hw_limit);
|
|||
void s390_set_max_pagesize(uint64_t pagesize, Error **errp);
|
||||
void s390_cmma_reset(void);
|
||||
void s390_enable_css_support(S390CPU *cpu);
|
||||
void s390_do_cpu_set_diag318(CPUState *cs, run_on_cpu_data arg);
|
||||
int s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch_id,
|
||||
int vq, bool assign);
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
|
|
|
@ -120,3 +120,7 @@ void kvm_s390_stop_interrupt(S390CPU *cpu)
|
|||
void kvm_s390_restart_interrupt(S390CPU *cpu)
|
||||
{
|
||||
}
|
||||
|
||||
void kvm_s390_set_diag318(CPUState *cs, uint64_t diag318_info)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1611,10 +1611,23 @@ static int handle_sw_breakpoint(S390CPU *cpu, struct kvm_run *run)
|
|||
return -ENOENT;
|
||||
}
|
||||
|
||||
void kvm_s390_set_diag318(CPUState *cs, uint64_t diag318_info)
|
||||
{
|
||||
CPUS390XState *env = &S390_CPU(cs)->env;
|
||||
|
||||
/* Feat bit is set only if KVM supports sync for diag318 */
|
||||
if (s390_has_feat(S390_FEAT_DIAG_318)) {
|
||||
env->diag318_info = diag318_info;
|
||||
cs->kvm_run->s.regs.diag318 = diag318_info;
|
||||
cs->kvm_run->kvm_dirty_regs |= KVM_SYNC_DIAG318;
|
||||
}
|
||||
}
|
||||
|
||||
static void handle_diag_318(S390CPU *cpu, struct kvm_run *run)
|
||||
{
|
||||
uint64_t reg = (run->s390_sieic.ipa & 0x00f0) >> 4;
|
||||
uint64_t diag318_info = run->s.regs.gprs[reg];
|
||||
CPUState *t;
|
||||
|
||||
/*
|
||||
* DIAG 318 can only be enabled with KVM support. As such, let's
|
||||
|
@ -1622,13 +1635,12 @@ static void handle_diag_318(S390CPU *cpu, struct kvm_run *run)
|
|||
*/
|
||||
if (!s390_has_feat(S390_FEAT_DIAG_318)) {
|
||||
kvm_s390_program_interrupt(cpu, PGM_SPECIFICATION);
|
||||
return;
|
||||
}
|
||||
|
||||
cpu->env.diag318_info = diag318_info;
|
||||
|
||||
if (can_sync_regs(CPU(cpu), KVM_SYNC_DIAG318)) {
|
||||
run->s.regs.diag318 = diag318_info;
|
||||
run->kvm_dirty_regs |= KVM_SYNC_DIAG318;
|
||||
CPU_FOREACH(t) {
|
||||
run_on_cpu(t, s390_do_cpu_set_diag318,
|
||||
RUN_ON_CPU_HOST_ULONG(diag318_info));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,5 +45,6 @@ void kvm_s390_set_max_pagesize(uint64_t pagesize, Error **errp);
|
|||
void kvm_s390_crypto_reset(void);
|
||||
void kvm_s390_restart_interrupt(S390CPU *cpu);
|
||||
void kvm_s390_stop_interrupt(S390CPU *cpu);
|
||||
void kvm_s390_set_diag318(CPUState *cs, uint64_t diag318_info);
|
||||
|
||||
#endif /* KVM_S390X_H */
|
||||
|
|
Loading…
Reference in a new issue