PPC: sPAPR: Only use getpagesize() when we run with kvm
We currently size the msi window trap page according to the host's page size so that we poke a working hole into a memory slot in case we overlap. However, this is only ever necessary with KVM active. Without KVM, we should rather try to be host platform agnostic and use a constant size: 4k. This fixes a build breakage on win32 hosts. Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
e5d7d2b0f5
commit
3c3b0ddefa
@ -469,6 +469,8 @@ static const MemoryRegionOps spapr_msi_ops = {
|
|||||||
|
|
||||||
void spapr_pci_msi_init(sPAPREnvironment *spapr, hwaddr addr)
|
void spapr_pci_msi_init(sPAPREnvironment *spapr, hwaddr addr)
|
||||||
{
|
{
|
||||||
|
uint64_t window_size = 4096;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* As MSI/MSIX interrupts trigger by writing at MSI/MSIX vectors,
|
* As MSI/MSIX interrupts trigger by writing at MSI/MSIX vectors,
|
||||||
* we need to allocate some memory to catch those writes coming
|
* we need to allocate some memory to catch those writes coming
|
||||||
@ -476,10 +478,19 @@ void spapr_pci_msi_init(sPAPREnvironment *spapr, hwaddr addr)
|
|||||||
* As MSIMessage:addr is going to be the same and MSIMessage:data
|
* As MSIMessage:addr is going to be the same and MSIMessage:data
|
||||||
* is going to be a VIRQ number, 4 bytes of the MSI MR will only
|
* is going to be a VIRQ number, 4 bytes of the MSI MR will only
|
||||||
* be used.
|
* be used.
|
||||||
|
*
|
||||||
|
* For KVM we want to ensure that this memory is a full page so that
|
||||||
|
* our memory slot is of page size granularity.
|
||||||
*/
|
*/
|
||||||
|
#ifdef CONFIG_KVM
|
||||||
|
if (kvm_enabled()) {
|
||||||
|
window_size = getpagesize();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
spapr->msi_win_addr = addr;
|
spapr->msi_win_addr = addr;
|
||||||
memory_region_init_io(&spapr->msiwindow, NULL, &spapr_msi_ops, spapr,
|
memory_region_init_io(&spapr->msiwindow, NULL, &spapr_msi_ops, spapr,
|
||||||
"msi", getpagesize());
|
"msi", window_size);
|
||||||
memory_region_add_subregion(get_system_memory(), spapr->msi_win_addr,
|
memory_region_add_subregion(get_system_memory(), spapr->msi_win_addr,
|
||||||
&spapr->msiwindow);
|
&spapr->msiwindow);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user