From patchwork Mon May 9 16:29:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 9047681 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 48525BF29F for ; Mon, 9 May 2016 16:45:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 735C020145 for ; Mon, 9 May 2016 16:45:26 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 67C5020148 for ; Mon, 9 May 2016 16:45:24 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1azoGr-00048p-UV; Mon, 09 May 2016 16:43:01 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1azoGr-00048V-0N for xen-devel@lists.xenproject.org; Mon, 09 May 2016 16:43:01 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id 78/0F-09532-41EB0375; Mon, 09 May 2016 16:43:00 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrGLMWRWlGSWpSXmKPExsXitHSDva7IPoN wg02zGS2+b5nM5MDocfjDFZYAxijWzLyk/IoE1owJG3wK+ngrtj+azd7AeJuri5GTQ0LAX+Ls rJWsIDabgI7E1KeXwGwRAVuJ/u/fgWwuDmaBNYwSTxacYuxi5OAQFrCWWPPWC6SGRUBFYt6P7 2wgNq+Au8Tv16eZIWbKSZw//hPMFgKqWT91FlSNoMTJmU9YQGxmAQmJgy9eMIOMlBDglvjbbT +BkWcWkqpZSKoWMDKtYlQvTi0qSy3SNdJLKspMzyjJTczM0TU0MNPLTS0uTkxPzUlMKtZLzs/ dxAgMDwYg2MG47K/TIUZJDiYlUV5XRr1wIb6k/JTKjMTijPii0pzU4kOMMhwcShK8B/cYhAsJ FqWmp1akZeYAAxUmLcHBoyTCexEkzVtckJhbnJkOkTrFqCglznsSJCEAksgozYNrg0XHJUZZK WFeRqBDhHgKUotyM0tQ5V8xinMwKglDjOfJzCuBm/4KaDET0GI5Nn2QxSWJCCmpBsYWQfddET /TfOYcX65vemZikTQny4qE+9fOyASv2fjpu/PZ4gDvLedeBxmqH//y5NNmN63scgWuGc0BJ65 u8MxtVq60fr2yoG3evukW9ocTJm4V5qhfqcgdI+Dq4rl83iH+60F5V5KTNywq3G559L2ujcTE 1UuU/nwy6FIssiuPbj6rdrXg2jUlluKMREMt5qLiRABH+HuNiQIAAA== X-Env-Sender: prvs=930fe50b8=Paul.Durrant@citrix.com X-Msg-Ref: server-13.tower-21.messagelabs.com!1462812178!13427562!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 28973 invoked from network); 9 May 2016 16:42:59 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-13.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 9 May 2016 16:42:59 -0000 X-IronPort-AV: E=Sophos;i="5.24,601,1454976000"; d="scan'208";a="359271878" From: Paul Durrant To: , Date: Mon, 9 May 2016 17:29:23 +0100 Message-ID: <1462811363-16219-1-git-send-email-paul.durrant@citrix.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 X-DLP: MIA1 Cc: Anthony Perard , Paolo Bonzini , Paul Durrant , Stefano Stabellini Subject: [Xen-devel] [PATCH v2] xen-hvm: ignore background I/O sections X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since Xen will correctly handle accesses to unimplemented I/O ports (by returning all 1's for reads and ignoring writes) there is no need for QEMU to register backgroud I/O sections. This patch therefore adds checks to xen_io_add/del so that sections with memory-region ops pointing at 'unassigned_io_ops' are ignored. Signed-off-by: Paul Durrant Cc: Stefano Stabellini Cc: Anthony Perard Cc: Paolo Bonzini --- v2: - Add missing braces --- xen-hvm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xen-hvm.c b/xen-hvm.c index 039680a..8ab44f0 100644 --- a/xen-hvm.c +++ b/xen-hvm.c @@ -510,8 +510,12 @@ static void xen_io_add(MemoryListener *listener, MemoryRegionSection *section) { XenIOState *state = container_of(listener, XenIOState, io_listener); + MemoryRegion *mr = section->mr; - memory_region_ref(section->mr); + if (mr->ops == &unassigned_io_ops) + return; + + memory_region_ref(mr); xen_map_io_section(xen_xc, xen_domid, state->ioservid, section); } @@ -520,10 +524,14 @@ static void xen_io_del(MemoryListener *listener, MemoryRegionSection *section) { XenIOState *state = container_of(listener, XenIOState, io_listener); + MemoryRegion *mr = section->mr; + + if (mr->ops == &unassigned_io_ops) + return; xen_unmap_io_section(xen_xc, xen_domid, state->ioservid, section); - memory_region_unref(section->mr); + memory_region_unref(mr); } static void xen_device_realize(DeviceListener *listener,