Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'powerpc-6.8-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:

- Fix a crash when hot adding a PCI device to an LPAR since
recent changes

- Fix nested KVM level-2 guest reboot failure due to empty
'arch_compat'

Thanks to Amit Machhiwal, Aneesh Kumar K.V (IBM), Brian King, Gaurav
Batra, and Vaibhav Jain.

* tag 'powerpc-6.8-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
KVM: PPC: Book3S HV: Fix L2 guest reboot failure due to empty 'arch_compat'
powerpc/pseries/iommu: DLPAR add doesn't completely initialize pci_controller

+73 -10
+10
arch/powerpc/include/asm/ppc-pci.h
··· 30 30 void *data); 31 31 extern void pci_devs_phb_init_dynamic(struct pci_controller *phb); 32 32 33 + #if defined(CONFIG_IOMMU_API) && (defined(CONFIG_PPC_PSERIES) || \ 34 + defined(CONFIG_PPC_POWERNV)) 35 + extern void ppc_iommu_register_device(struct pci_controller *phb); 36 + extern void ppc_iommu_unregister_device(struct pci_controller *phb); 37 + #else 38 + static inline void ppc_iommu_register_device(struct pci_controller *phb) { } 39 + static inline void ppc_iommu_unregister_device(struct pci_controller *phb) { } 40 + #endif 41 + 42 + 33 43 /* From rtas_pci.h */ 34 44 extern void init_pci_config_tokens (void); 35 45 extern unsigned long get_phb_buid (struct device_node *);
+17 -6
arch/powerpc/kernel/iommu.c
··· 1360 1360 struct pci_controller *hose; 1361 1361 1362 1362 if (!dev_is_pci(dev)) 1363 - return ERR_PTR(-EPERM); 1363 + return ERR_PTR(-ENODEV); 1364 1364 1365 1365 pdev = to_pci_dev(dev); 1366 1366 hose = pdev->bus->sysdata; ··· 1409 1409 NULL, 1410 1410 }; 1411 1411 1412 + void ppc_iommu_register_device(struct pci_controller *phb) 1413 + { 1414 + iommu_device_sysfs_add(&phb->iommu, phb->parent, 1415 + spapr_tce_iommu_groups, "iommu-phb%04x", 1416 + phb->global_number); 1417 + iommu_device_register(&phb->iommu, &spapr_tce_iommu_ops, 1418 + phb->parent); 1419 + } 1420 + 1421 + void ppc_iommu_unregister_device(struct pci_controller *phb) 1422 + { 1423 + iommu_device_unregister(&phb->iommu); 1424 + iommu_device_sysfs_remove(&phb->iommu); 1425 + } 1426 + 1412 1427 /* 1413 1428 * This registers IOMMU devices of PHBs. This needs to happen 1414 1429 * after core_initcall(iommu_init) + postcore_initcall(pci_driver_init) and ··· 1434 1419 struct pci_controller *hose; 1435 1420 1436 1421 list_for_each_entry(hose, &hose_list, list_node) { 1437 - iommu_device_sysfs_add(&hose->iommu, hose->parent, 1438 - spapr_tce_iommu_groups, "iommu-phb%04x", 1439 - hose->global_number); 1440 - iommu_device_register(&hose->iommu, &spapr_tce_iommu_ops, 1441 - hose->parent); 1422 + ppc_iommu_register_device(hose); 1442 1423 } 1443 1424 return 0; 1444 1425 }
+24 -2
arch/powerpc/kvm/book3s_hv.c
··· 391 391 /* Dummy value used in computing PCR value below */ 392 392 #define PCR_ARCH_31 (PCR_ARCH_300 << 1) 393 393 394 + static inline unsigned long map_pcr_to_cap(unsigned long pcr) 395 + { 396 + unsigned long cap = 0; 397 + 398 + switch (pcr) { 399 + case PCR_ARCH_300: 400 + cap = H_GUEST_CAP_POWER9; 401 + break; 402 + case PCR_ARCH_31: 403 + cap = H_GUEST_CAP_POWER10; 404 + break; 405 + default: 406 + break; 407 + } 408 + 409 + return cap; 410 + } 411 + 394 412 static int kvmppc_set_arch_compat(struct kvm_vcpu *vcpu, u32 arch_compat) 395 413 { 396 414 unsigned long host_pcr_bit = 0, guest_pcr_bit = 0, cap = 0; ··· 442 424 break; 443 425 case PVR_ARCH_300: 444 426 guest_pcr_bit = PCR_ARCH_300; 445 - cap = H_GUEST_CAP_POWER9; 446 427 break; 447 428 case PVR_ARCH_31: 448 429 guest_pcr_bit = PCR_ARCH_31; 449 - cap = H_GUEST_CAP_POWER10; 450 430 break; 451 431 default: 452 432 return -EINVAL; ··· 456 440 return -EINVAL; 457 441 458 442 if (kvmhv_on_pseries() && kvmhv_is_nestedv2()) { 443 + /* 444 + * 'arch_compat == 0' would mean the guest should default to 445 + * L1's compatibility. In this case, the guest would pick 446 + * host's PCR and evaluate the corresponding capabilities. 447 + */ 448 + cap = map_pcr_to_cap(guest_pcr_bit); 459 449 if (!(cap & nested_capabilities)) 460 450 return -EINVAL; 461 451 }
+18 -2
arch/powerpc/kvm/book3s_hv_nestedv2.c
··· 138 138 vector128 v; 139 139 int rc, i; 140 140 u16 iden; 141 + u32 arch_compat = 0; 141 142 142 143 vcpu = gsm->data; 143 144 ··· 348 347 break; 349 348 } 350 349 case KVMPPC_GSID_LOGICAL_PVR: 351 - rc = kvmppc_gse_put_u32(gsb, iden, 352 - vcpu->arch.vcore->arch_compat); 350 + /* 351 + * Though 'arch_compat == 0' would mean the default 352 + * compatibility, arch_compat, being a Guest Wide 353 + * Element, cannot be filled with a value of 0 in GSB 354 + * as this would result into a kernel trap. 355 + * Hence, when `arch_compat == 0`, arch_compat should 356 + * default to L1's PVR. 357 + */ 358 + if (!vcpu->arch.vcore->arch_compat) { 359 + if (cpu_has_feature(CPU_FTR_ARCH_31)) 360 + arch_compat = PVR_ARCH_31; 361 + else if (cpu_has_feature(CPU_FTR_ARCH_300)) 362 + arch_compat = PVR_ARCH_300; 363 + } else { 364 + arch_compat = vcpu->arch.vcore->arch_compat; 365 + } 366 + rc = kvmppc_gse_put_u32(gsb, iden, arch_compat); 353 367 break; 354 368 } 355 369
+4
arch/powerpc/platforms/pseries/pci_dlpar.c
··· 35 35 36 36 pseries_msi_allocate_domains(phb); 37 37 38 + ppc_iommu_register_device(phb); 39 + 38 40 /* Create EEH devices for the PHB */ 39 41 eeh_phb_pe_create(phb); 40 42 ··· 77 75 return 1; 78 76 } 79 77 } 78 + 79 + ppc_iommu_unregister_device(phb); 80 80 81 81 pseries_msi_free_domains(phb); 82 82