From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46660) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYvt2-0004U5-EF for qemu-devel@nongnu.org; Mon, 07 Sep 2015 08:51:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZYvsz-0005NW-7h for qemu-devel@nongnu.org; Mon, 07 Sep 2015 08:51:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58995) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYvsz-0005NR-2B for qemu-devel@nongnu.org; Mon, 07 Sep 2015 08:51:01 -0400 References: <1437389593-15297-1-git-send-email-real@ispras.ru> From: Paolo Bonzini Message-ID: <55ED8830.8020506@redhat.com> Date: Mon, 7 Sep 2015 14:50:56 +0200 MIME-Version: 1.0 In-Reply-To: <1437389593-15297-1-git-send-email-real@ispras.ru> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2] PAM: make PAM emulation closer to documentation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Efimov Vasily , qemu-devel@nongnu.org Cc: Kirill Batuzov , "Michael S. Tsirkin" On 20/07/2015 12:53, Efimov Vasily wrote: > + read_src =3D address_space_translate(read_as, pam_offset, > + &offset_within_read_leaf, &unus= ed, > + false); > + > + if (memory_region_is_ram(read_src) || memory_region_is_romd(read_s= rc)) { > + /* Read source is RAM or ROM. > + Make current PAM region a ROM with body inside read source.= */ > + cur->ram_addr =3D read_src->ram_addr + offset_within_read_leaf= ; > + cur->rom_device =3D true; > + cur->romd_mode =3D true; > + } else { > + /* Make current PAM region a clearly I/O region. */ > + cur->ram_addr =3D ~(ram_addr_t) 0; > + cur->rom_device =3D false; > + cur->romd_mode =3D false; > + } > + > + pam->write_as =3D write_as; > + pam->read_as =3D read_as; > +} > + Hi Vasily, I agree that this patch is an improvement compared to the earlier versions, but it's still a bit of an abstraction violation and I'm not sure if it works with KVM. Let's see if we can improve things. Please correct me on the following: 1) For the "Make current PAM region a ROM" case, we can get the ram_addr_t directly from the pc.bios and pc.rom MemoryRegions, and poke into pam->region[1] and pam->region[2] when we create them. 2) For the "Make current PAM region an I/O region" case, you could add an IOMMU region that to 0xc0000-0xfffff. The listener would disable pam->region[1] if address_space_translate returns an I/O region and enable it if it returns RAM/ROM. However, I cannot understand or remember what is the case where you get an I/O region. Paolo