Received: from eggs.gnu.org ([2001:4830:134:3::10]:42883) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aCFcs-0003PM-6d for qemu-devel@nongnu.org; Thu, 24 Dec 2015 18:48:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aCFcr-0004Jk-0L for qemu-devel@nongnu.org; Thu, 24 Dec 2015 18:48:54 -0500 Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Programmingkid In-Reply-To: Date: Thu, 24 Dec 2015 18:48:43 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <0631F53E-BA90-4F7C-8AB6-55A2E6CE6FE9@gmail.com> References: <17B0D4FF-B829-47B5-85EF-4257EA0B4D6B@gmail.com> <9A7B9473-8E03-42FB-94BE-B217B1071C22@gmail.com> Subject: Re: [Qemu-devel] [Qemu-ppc] [Qemu-discuss] phys_page_find() returning §ions[PHYS_SECTION_UNASSIGNED] List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: BALATON Zoltan Cc: Peter Maydell , "qemu-ppc@nongnu.org list:PowerPC" , qemu-devel qemu-devel , qemu-discuss On Dec 24, 2015, at 5:45 PM, BALATON Zoltan wrote: > On Thu, 24 Dec 2015, Programmingkid wrote: >> On Dec 24, 2015, at 10:34 AM, Peter Maydell wrote: >>> On 24 December 2015 at 01:00, Programmingkid = wrote: >>>> I'm having problems with the pci_dma_read() function. When using >>>> a Mac OS X guest, the data that this function returns is all zeros. >>>> After doing a lot of instruction tracing, I tracked the problem to = a >>>> function called phys_page_find(). It always returns >>>> §ions[PHYS_SECTION_UNASSIGNED]. What I would like to know is >>>> what is an unassigned section? How is memory suppose to be = assigned? >>>=20 >>> Unassigned here is an area of the physical address space which has >>> nothing in it (no RAM, no device, just nothing). Depending on the >>> guest CPU architecture, accessing this might cause a bus fault >>> or might just return a dummy value. (It looks like it's the latter >>> for your case.) >>>=20 >>> One way to get this is if the guest mis-programs the PCI DMA >>> so that it tries to do DMA from a wrong address. Or maybe the >>> PCI host controller emulation isn't right and we're not >>> using the right DMA address. Or there's some RAM or something >>> that the guest expects to be present in the machine but which >>> is not implemented by us. >>>=20 >>> You need to find out why we're trying to DMA to/from this >>> bogus address, I think. >>=20 >> Mac OS X has to give the RTL8139 network interface card an address to = a memory buffer. It is used to send packets to the network interface = card from the guest. How the address is allocated in Mac OS X seems = simple enough. This address is a physical address and not a virtual = address, so that seems good. One address that is used is 0x13d9000. I = think that would be around the 19 MB area. It should be ok for the = rtl8139 to access because it is in the "system" memory region. >=20 > Not sure this is relevant here but previously I've found a patch was = necessary to OpenBIOS for me to make DMA work with RTL8139 otherwise = sending data was not working correctly. Here's the patch in case it = could help or give you an idea: >=20 > http://www.openfirmware.info/pipermail/openbios/2014-June/008363.html >=20 > But it could be your problem is different and the patch is not = relevant. >=20 > Regards, > BALATON Zoltan Thank you very much for the help. It looks like the Mac OS X driver = already sets the bus mastering bit.=20=