[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Consuming PCI device in PV kernel

Hello Ian,

>>  This is what I am doing:
>> void *micropv_remap_page(uint64_t physical_address, uint64_t 
>> machine_address, int readonly)
>> {
>>     // Update the mapping. I have had problems using a readonly mapping, 
>> however I'm not sure whether that was to do with
>>     // this call, or the page that was being mapped.
>>     int rc = HYPERVISOR_update_va_mapping(physical_address, 
>> __pte(machine_address | (readonly ? L1_PROT_RO : L1_PROT)), UVMF_INVLPG);

> The first argument should be the virtual address, I think. But maybe you
> have a 1:1 mapping so this doesn't matter?

I   don't   think   so.  I  inverted the parameter order and it failed
during  the memory address validation. Also this is the same call as I
use for mapping the shared_info at start of day.

>>         ptr = micropv_remap_page((uint64_t)buffer, 
>> pci_device.bar[0].memory.address << 4, 0);

> Are you sure about that BAR decode? Don't you need to at least mask the
> bottom 4 bits?

Yes  I  am sure on this. The decoded addresses look correct. I removed
it and get this output from xl dmesg

(XEN) mm.c:828:d304v0 pg_owner 304 l1e_owner 304, but real_pg_owner 0
(XEN) mm.c:899:d304v0 Error getting mfn f7d0 (pfn d2bd) from L1 entry 
000000000f7d0027 for l1e_owner=304, pg_owner=304

> You might also need to mask it to a page boundary, depending on what the
> address is...

The BAR is page aligned the value is f7d00000

Best regards,
 Simon                            mailto:furryfuttock@xxxxxxxxx

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.