Yet more special casing code you want to add. I said no to this
model, and unless you can address the issue _without_ adding
a lot of special casing code, the answer will remain no (subject
What about this?
@@ -301,6 +301,19 @@ void pci_setup(void)
pci_mem_start <<= 1;
}
+ for ( i = 0; i < memory_map.nr_map ; i++ )
+ {
+ uint64_t reserved_start, reserved_size;
+ reserved_start = memory_map.map[i].addr;
+ reserved_size = memory_map.map[i].size;
+ if ( check_overlap(pci_mem_start, pci_mem_end - pci_mem_start,
+ reserved_start, reserved_size) )
+ {
+ printf("Reserved device memory conflicts current PCI memory.\n");
+ BUG();
+ }
+ }
So what would the cure be if someone ran into this BUG() (other
than removing the device associated with the conflicting RMRR)?
Maybe I can move this chunk of codes downward those actual allocation
to check if RDM conflicts with the final allocation, and then just
disable those associated devices by writing PCI_COMMAND without BUG()
like this draft code,
/* If pci bars conflict with RDM we need to disable this pci device. */
for ( devfn = 0; devfn < 256; devfn++ )
{
bar_sz = pci_readl(devfn, bar_reg);
bar_data = pci_readl(devfn, bar_reg);
bar_data_upper = pci_readl(devfn, bar_reg + 4);
/* Until here we don't conflict high memory. */
if ( bar_data_upper )
continue;
for ( i = 0; i < memory_map.nr_map ; i++ )
{
uint64_t reserved_start, reserved_size;
reserved_start = memory_map.map[i].addr;
reserved_size = memory_map.map[i].size;
if ( check_overlap(bar_data & ~(bar_sz - 1), bar_sz,
reserved_start, reserved_size) )
{
printf("Reserved device memory conflicts with this pci
bar,"
" so just disable this device.\n");
/* Now disable this device */
cmd = pci_readw(devfn, PCI_COMMAND);
pci_writew(devfn, PCI_COMMAND, ~cmd);
}
}
}
If this is still not fine to you, look I have to raise a request to
co-maintainers since its hard to step next in practice.
Hi all guys, what about your idea?
Thanks
Tiejun
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel