From nobody Sun Apr 12 00:55:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1772589180; cv=none; d=zohomail.com; s=zohoarc; b=cMDXXKxHdYNSGpCeFPQfOZ7aDW9fCpW2nn9acJ4OOPLcdCx71Sg2JjVdLnGOC5alGnEvTn/Lnx6EfV5rkTYG8s74foYF+LRPxtzDdJzRwmr1PHs+dnAN4OFzy6RycZ4pYTh6hGEBV8w+73o3Bfb+hivX55WeCS9EtQY15bWJqAg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772589180; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rZOO08zLikZY030P2ehrGV6veLejKIl076oxwM9/gTs=; b=h6m4lynOX20UMRoMxtLHcM94k4DCiRUWXeKeMcBkGpK4+cfdEF6OvgpHtn3rkQIOnBjaw8HA0Sfr6m6dnZfZerlDYwc0ubnlxLCsMfa2p8wQCe/EDnkXy4tnf7cW1d20t7348ajrnccuX1OWioAgd1mJYX9K96Z5UW+X+/1fpWM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 177258918040946.71620397428046; Tue, 3 Mar 2026 17:53:00 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1245076.1544470 (Exim 4.92) (envelope-from ) id 1vxbPk-00076R-JS; Wed, 04 Mar 2026 01:52:40 +0000 Received: by outflank-mailman (output) from mailman id 1245076.1544470; Wed, 04 Mar 2026 01:52:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vxbPk-00076K-DH; Wed, 04 Mar 2026 01:52:40 +0000 Received: by outflank-mailman (input) for mailman id 1245076; Wed, 04 Mar 2026 01:52:38 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vxbPi-00069T-Ld for xen-devel@lists.xenproject.org; Wed, 04 Mar 2026 01:52:38 +0000 Received: from mail-vs1-xe32.google.com (mail-vs1-xe32.google.com [2607:f8b0:4864:20::e32]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id d219c63d-176c-11f1-b164-2bf370ae4941; Wed, 04 Mar 2026 02:52:38 +0100 (CET) Received: by mail-vs1-xe32.google.com with SMTP id ada2fe7eead31-5ff1703cb9eso1668728137.3 for ; Tue, 03 Mar 2026 17:52:37 -0800 (PST) Received: from gmail.com (ip190-5-140-138.intercom.com.sv. [190.5.140.138]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-94df6577693sm16742382241.9.2026.03.03.17.52.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Mar 2026 17:52:35 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d219c63d-176c-11f1-b164-2bf370ae4941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772589157; x=1773193957; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rZOO08zLikZY030P2ehrGV6veLejKIl076oxwM9/gTs=; b=eXk/08fdK1Tui/DCmFmi2fHGK0ecEBAJkf9fZhkl1StlYMNMxgHBwFl5Zh3hE+5J9K n3Axy7FwydzUkCjGruiBggDhzTwBFnX+XydUkvdMPEbTaooYHFRrCcQeS9qoE5s1wq9n VcZLo5bWtuNjuv3sm/3UurFdkkVx0eGuVJj6V4nWA5hm40Li+amUkVb/xMf/HweDevf0 T1adE0UmZsPsvl2RZMQQiKLNQ7sfMJUw/EvCbTGsbLa6TQvrHtDoRL4DS4IkTmhUPMmd QhEuw/N92QpYUxRKnrTBtuzcNE1eV7tsUoLffZh+RkkT2lXRhKlyH//IBf5FiPmMnhTH rSxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772589157; x=1773193957; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=rZOO08zLikZY030P2ehrGV6veLejKIl076oxwM9/gTs=; b=pzVvZ6lUx14VYhmPDknIA+rBv5qpbwaF5yg6DyVY2iPaE3v+bX8ASSvfnhsNwQDfwb IDP0isornjJouAwj1g1EXW5eiP3CmF4yDpxdhsfqdta7DrzS1LQG6H7BIu7BrMLEs0to rzvjKW3Oy5QwZlBWH0M9wp/yyVqWLAX7C78/CxNA9PRWI/h81hlc9syYf8Q043Z15xec l7hIo50n7zS31SQVDSasdeVr7oiH+WukaBVKqKcTG/2IuHLYzykwROZmAX91dh9ylPBx 8g1PjV5MemLeUZACjprzz4I3w8GHlGR/O3vJUDx1eoQWFV2APpDr/Uf9gftpSK4su5uU YDsg== X-Forwarded-Encrypted: i=1; AJvYcCWpCdSYjNYFtOfymWwWkoO0PRuYTEz2mXGdL9xXH/mzB6YwxiZSAxNQ0PB35gmVlL588vxvl5kKafs=@lists.xenproject.org X-Gm-Message-State: AOJu0Yz5TK0+LKbDoD07VeqXWgp5w0GxmuIkRgPB9Tk0A9MyRDjaV2Ul quEPzGVZ+lpD43e6o/LFP6ooNwrM65T9RUqzlcnuMEPmFSDYj3W26922 X-Gm-Gg: ATEYQzyKvPXp69wkaW+SZy9If/u3e1kyxj2Nz3PavIIxG6FycVm09ztBsinxHjDTp9p 2eMks7a9J1YrhOHjb2MEa5j2nuD/eCkIgOYPGgLYdbj47VYTihGGivv/7jBOsu5mtrZt4VZMdEr 4ogTgbJxMkC/ZyEuSq5ii3QGOj+Cqo7hntjTdtsCJGQlEHakUB8zV8VC7+l2Bc+BDrPwTEh5HbN fSKl4MjXNGM8LtZ2X1lFxxCLahJhzERHePF8HwaZMHO6JhN8nnoma1yEzuve/H1vJl1bhXGsFft uFT/anz47nxkKFzvZUmH7EicRJ23NI9Gg1aHMXovABZLcygwX0oNA+WNWYxR8XO+Pvu9pR65jKb k7vrvWnW+22CGuaKxpqGpdER2+XcihPFB1ljULBUFOPXJ8ApTnJFJHWuW5FioBJZOiTYhSmC7+2 ip+o1ZVDro6X7kpMCUZKZ3XiF+UFG5vGK9kiMyS+t+MIRFFYciSxTQM6Z7EA== X-Received: by 2002:a05:6102:c52:b0:5fe:13bc:f13a with SMTP id ada2fe7eead31-5ffaafb23f5mr239107137.36.1772589156590; Tue, 03 Mar 2026 17:52:36 -0800 (PST) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org, Stefano Stabellini , Anthony PERARD , Paul Durrant , "Edgar E. Iglesias" , "Michael S. Tsirkin" , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Cc: edgar.iglesias@amd.com, xen-devel@lists.xenproject.org Subject: [PATCH v1 4/5] hw/xen-hvm: Add a mapcache arg to xen_register_ioreq() Date: Wed, 4 Mar 2026 02:52:20 +0100 Message-ID: <20260304015222.979224-5-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260304015222.979224-1-edgar.iglesias@gmail.com> References: <20260304015222.979224-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1772589181482158500 Content-Type: text/plain; charset="utf-8" From: "Edgar E. Iglesias" Add a mapcache argument to xen_register_ioreq() allowing the caller to optionally disable the mapcache. All callers still call it with mapcache =3D true so there's no functional change yet. Signed-off-by: Edgar E. Iglesias Reviewed-by: Stefano Stabellini --- hw/i386/xen/xen-hvm.c | 2 +- hw/xen/xen-hvm-common.c | 18 ++++++++++++------ hw/xen/xen-pvh-common.c | 3 ++- include/hw/xen/xen-hvm-common.h | 3 ++- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c index a6e1683885..c7bfcaae8e 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -622,7 +622,7 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion= **ram_memory) =20 xen_register_ioreq(state, max_cpus, HVM_IOREQSRV_BUFIOREQ_ATOMIC, - &xen_memory_listener); + &xen_memory_listener, true); =20 xen_is_stubdomain =3D xen_check_stubdomain(state->xenstore); =20 diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c index 59c73dfaeb..8c825588ae 100644 --- a/hw/xen/xen-hvm-common.c +++ b/hw/xen/xen-hvm-common.c @@ -473,7 +473,9 @@ static void handle_ioreq(XenIOState *state, ioreq_t *re= q) case IOREQ_TYPE_TIMEOFFSET: break; case IOREQ_TYPE_INVALIDATE: - xen_invalidate_map_cache(); + if (xen_map_cache_enabled()) { + xen_invalidate_map_cache(); + } break; case IOREQ_TYPE_PCI_CONFIG: cpu_ioreq_config(state, req); @@ -823,7 +825,8 @@ void xen_shutdown_fatal_error(const char *fmt, ...) =20 static void xen_do_ioreq_register(XenIOState *state, unsigned int max_cpus, - const MemoryListener *xen_memory_listene= r) + const MemoryListener *xen_memory_listene= r, + bool mapcache) { int i, rc; =20 @@ -874,11 +877,13 @@ static void xen_do_ioreq_register(XenIOState *state, state->bufioreq_local_port =3D rc; } /* Init RAM management */ + if (mapcache) { #ifdef XEN_COMPAT_PHYSMAP - xen_map_cache_init(xen_phys_offset_to_gaddr, state); + xen_map_cache_init(xen_phys_offset_to_gaddr, state); #else - xen_map_cache_init(NULL, state); + xen_map_cache_init(NULL, state); #endif + } =20 qemu_add_vm_change_state_handler(xen_hvm_change_state_handler, state); =20 @@ -901,7 +906,8 @@ err: =20 void xen_register_ioreq(XenIOState *state, unsigned int max_cpus, uint8_t handle_bufioreq, - const MemoryListener *xen_memory_listener) + const MemoryListener *xen_memory_listener, + bool mapcache) { int rc; =20 @@ -922,7 +928,7 @@ void xen_register_ioreq(XenIOState *state, unsigned int= max_cpus, state->has_bufioreq =3D handle_bufioreq !=3D HVM_IOREQSRV_BUFIOREQ_OFF; rc =3D xen_create_ioreq_server(xen_domid, handle_bufioreq, &state->ios= ervid); if (!rc) { - xen_do_ioreq_register(state, max_cpus, xen_memory_listener); + xen_do_ioreq_register(state, max_cpus, xen_memory_listener, mapcac= he); } else { warn_report("xen: failed to create ioreq server"); } diff --git a/hw/xen/xen-pvh-common.c b/hw/xen/xen-pvh-common.c index 1381310fc7..4fade017bb 100644 --- a/hw/xen/xen-pvh-common.c +++ b/hw/xen/xen-pvh-common.c @@ -202,7 +202,8 @@ static void xen_pvh_init(MachineState *ms) xen_pvh_init_ram(s, sysmem); xen_register_ioreq(&s->ioreq, ms->smp.max_cpus, xpc->handle_bufioreq, - &xen_memory_listener); + &xen_memory_listener, + true); =20 if (s->cfg.virtio_mmio_num) { xen_create_virtio_mmio_devices(s); diff --git a/include/hw/xen/xen-hvm-common.h b/include/hw/xen/xen-hvm-commo= n.h index e1beca062f..d177ff14ea 100644 --- a/include/hw/xen/xen-hvm-common.h +++ b/include/hw/xen/xen-hvm-common.h @@ -91,7 +91,8 @@ void xen_device_unrealize(DeviceListener *listener, Devic= eState *dev); void xen_hvm_change_state_handler(void *opaque, bool running, RunState rst= ate); void xen_register_ioreq(XenIOState *state, unsigned int max_cpus, uint8_t handle_bufioreq, - const MemoryListener *xen_memory_listener); + const MemoryListener *xen_memory_listener, + bool mapcache); =20 void cpu_ioreq_pio(ioreq_t *req); #endif /* HW_XEN_HVM_COMMON_H */ --=20 2.43.0