From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZeDY-00084l-3l for qemu-devel@nongnu.org; Wed, 09 Sep 2015 08:11:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZeDU-0001Ee-3O for qemu-devel@nongnu.org; Wed, 09 Sep 2015 08:11:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50976) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZeDT-0001EX-VN for qemu-devel@nongnu.org; Wed, 09 Sep 2015 08:11:08 -0400 References: <1437389593-15297-1-git-send-email-real@ispras.ru> <55ED8830.8020506@redhat.com> <55F01FFA.8000406@ispras.ru> From: Paolo Bonzini Message-ID: <55F021D8.2000404@redhat.com> Date: Wed, 9 Sep 2015 14:11:04 +0200 MIME-Version: 1.0 In-Reply-To: <55F01FFA.8000406@ispras.ru> Content-Type: text/plain; charset=utf-8 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: =?UTF-8?B?0JXRhNC40LzQvtCyINCS0LDRgdC40LvQuNC5?= , qemu-devel@nongnu.org Cc: Kirill Batuzov , "Michael S. Tsirkin" On 09/09/2015 14:03, =D0=95=D1=84=D0=B8=D0=BC=D0=BE=D0=B2 =D0=92=D0=B0=D1= =81=D0=B8=D0=BB=D0=B8=D0=B9 wrote: > We also can set up redirection at machine initialization, but using of > listener makes sure redirection is actual at runtime. I do not know > case in which regions at the PAM addresses are changed dynamically > during guest work. But even during machine initialization the memory > tree is changed multiple times. So, listener at least ensures the last > version of tree is used for redirection choice. Fair enough. >> 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. > As I see, IOMMU cannot be used for CPU access to memory because of > assertion (!section->mr->iommu_ops) in > exec.c: address_space_translate_for_iotlb > IOMMU is used for redirection of device and debug access through > address_space_translate. Please correct me if I miss something. You're right. We could remove the assertion and reuse subpage_ops for IOMMUs, it would not allow running code but it would allow accesses. But it's not necessary because this can never happen in practice. > There is no known case in which an I/O region is at PAM addresses. > But it is theoretically possible. Hence, I decide to implement it > instead of insert an assertion. Let's keep the code simple and assert. If you put a BAR at 0xc0000-0xfffff, RAM wins, so this situation should never happen on x86 chipsets. Paolo