From patchwork Thu Oct 3 18:56:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 13821424 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F3CEBCF34BC for ; Thu, 3 Oct 2024 18:58:15 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1swR0g-0000ku-AP; Thu, 03 Oct 2024 14:57:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1swR0f-0000kh-4V for qemu-devel@nongnu.org; Thu, 03 Oct 2024 14:57:09 -0400 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swR0d-0003IM-HU for qemu-devel@nongnu.org; Thu, 03 Oct 2024 14:57:08 -0400 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-5399041167cso2277800e87.0 for ; Thu, 03 Oct 2024 11:57:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727981825; x=1728586625; darn=nongnu.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=5QkDAThvHzn8nk+HGJi0H/5a08f7RDTFwzrMcXuWa4E=; b=blt0kg/ciKr3lHBLszQUlZKlcM+B0xX0jWfQLR0cieZsZ0F2MhD7opEqG/AtoGPGFI JbjIh1xNbo9i7jP8CPPB0u0weoBdskO+knIg+bcu30nNEkQ5lKpoaT5bW/yXek8UWAyM l8Bb3+F53c6W/sjcuaWZ1Tt/ZM/MurT7B3HxFT/5ABSzLidtLRhgTHEkCOYrBbk6Fotr r8w0iwGr+GywWY3IKhKf8Dre5cspjaspiDU84EEwQsyl/jbry/8IErxBU84OBgnwZLox 8I7m7tcON2Pd93bGXu/zwN8Jdigl7tyoD7h5cQZZszsV58tkHEjQ9p8Kx0F9X8JMahYo BGYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727981825; x=1728586625; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5QkDAThvHzn8nk+HGJi0H/5a08f7RDTFwzrMcXuWa4E=; b=gSw2BrS6r9mpJmOliTD7flauM7wu/ug9LakXQyY1b+csWPnb4vUbf5Lx3rl4+9mCm/ TZYW6NhgXD+kJ0Lk1wpaBXAvA3NB/wzOn9oQc5idqFibSBnMCvMr8XE9V8oXMSTBMPSt Cu8EdS64BOi2qfEADU2+7sfdwIonn4+qNg5IaDW4gX38iRM3o/1TGWi0MmFXsc3myUdA XjJEYostKGAGws5QeFAcT15UuR+qKKpOmrHRqGaICYPE6PqdXyI/s3X2IKuUs3qUDFxz IvdMiB4G9WSN/VjZRWZTVAJLm7XM6ab/lSfHFPTutm6hzXxrqUT1H/gzCqC62BUaCPgj 5UOw== X-Gm-Message-State: AOJu0YzkM1bFGbulElJWC5kj/0We0yO7RPedB8No0B96hXNqThoU6dh8 z+5Y0/i4cMM7UlZ6oi50MbrCu7YJ+riGEkC20znWrd5IJbPhWKHTaLrUUyUv X-Google-Smtp-Source: AGHT+IH+YJp2VQbmukXoxo+KucnNQOI52hduggo5ZWOqudKcMJoLnpK4pu8dv199MzOrbVPSxfrmWw== X-Received: by 2002:a05:6512:b29:b0:530:ab68:25c5 with SMTP id 2adb3069b0e04-539ab84e022mr346818e87.2.1727981824696; Thu, 03 Oct 2024 11:57:04 -0700 (PDT) Received: from gmail.com (213-67-3-247-no600.tbcn.telia.com. [213.67.3.247]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539a82510b0sm239556e87.40.2024.10.03.11.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Oct 2024 11:57:03 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Cc: sstabellini@kernel.org, anthony@xenproject.org, paul@xen.org, peter.maydell@linaro.org, edgar.iglesias@amd.com, xen-devel@lists.xenproject.org, "Dr. David Alan Gilbert" , Anthony PERARD , Thomas Huth , "Edgar E. Iglesias" Subject: [PULL v2 1/5] hw/xen: Remove deadcode Date: Thu, 3 Oct 2024 20:56:50 +0200 Message-ID: <20241003185655.1480819-2-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241003185655.1480819-1-edgar.iglesias@gmail.com> References: <20241003185655.1480819-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::136; envelope-from=edgar.iglesias@gmail.com; helo=mail-lf1-x136.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: "Dr. David Alan Gilbert" xen_be_copy_grant_refs is unused since 2019's 19f87870ba ("xen: remove the legacy 'xen_disk' backend") xen_config_dev_console is unused since 2018's 6d7c06c213 ("Remove broken Xen PV domain builder") Remove them. Signed-off-by: Dr. David Alan Gilbert Acked-by: Anthony PERARD Reviewed-by: Thomas Huth Reviewed-by: Edgar E. Iglesias Signed-off-by: Edgar E. Iglesias --- hw/xen/xen-legacy-backend.c | 18 ------------------ hw/xen/xen_devconfig.c | 8 -------- include/hw/xen/xen-legacy-backend.h | 5 ----- 3 files changed, 31 deletions(-) diff --git a/hw/xen/xen-legacy-backend.c b/hw/xen/xen-legacy-backend.c index 5514184f9c..e8e1ee4f7d 100644 --- a/hw/xen/xen-legacy-backend.c +++ b/hw/xen/xen-legacy-backend.c @@ -147,24 +147,6 @@ void xen_be_unmap_grant_refs(struct XenLegacyDevice *xendev, void *ptr, } } -int xen_be_copy_grant_refs(struct XenLegacyDevice *xendev, - bool to_domain, - XenGrantCopySegment segs[], - unsigned int nr_segs) -{ - int rc; - - assert(xendev->ops->flags & DEVOPS_FLAG_NEED_GNTDEV); - - rc = qemu_xen_gnttab_grant_copy(xendev->gnttabdev, to_domain, xen_domid, - segs, nr_segs, NULL); - if (rc) { - xen_pv_printf(xendev, 0, "xengnttab_grant_copy failed: %s\n", - strerror(-rc)); - } - return rc; -} - /* * get xen backend device, allocate a new one if it doesn't exist. */ diff --git a/hw/xen/xen_devconfig.c b/hw/xen/xen_devconfig.c index 2150869f60..45ae134b84 100644 --- a/hw/xen/xen_devconfig.c +++ b/hw/xen/xen_devconfig.c @@ -66,11 +66,3 @@ int xen_config_dev_vkbd(int vdev) xen_config_dev_dirs("vkbd", "vkbd", vdev, fe, be, sizeof(fe)); return xen_config_dev_all(fe, be); } - -int xen_config_dev_console(int vdev) -{ - char fe[256], be[256]; - - xen_config_dev_dirs("console", "console", vdev, fe, be, sizeof(fe)); - return xen_config_dev_all(fe, be); -} diff --git a/include/hw/xen/xen-legacy-backend.h b/include/hw/xen/xen-legacy-backend.h index 943732b8d1..e198b120c5 100644 --- a/include/hw/xen/xen-legacy-backend.h +++ b/include/hw/xen/xen-legacy-backend.h @@ -50,10 +50,6 @@ void *xen_be_map_grant_refs(struct XenLegacyDevice *xendev, uint32_t *refs, void xen_be_unmap_grant_refs(struct XenLegacyDevice *xendev, void *ptr, uint32_t *refs, unsigned int nr_refs); -int xen_be_copy_grant_refs(struct XenLegacyDevice *xendev, - bool to_domain, XenGrantCopySegment segs[], - unsigned int nr_segs); - static inline void *xen_be_map_grant_ref(struct XenLegacyDevice *xendev, uint32_t ref, int prot) { @@ -70,6 +66,5 @@ static inline void xen_be_unmap_grant_ref(struct XenLegacyDevice *xendev, void xen_config_cleanup(void); int xen_config_dev_vfb(int vdev, const char *type); int xen_config_dev_vkbd(int vdev); -int xen_config_dev_console(int vdev); #endif /* HW_XEN_LEGACY_BACKEND_H */ From patchwork Thu Oct 3 18:56:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 13821425 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 08136CF34BF for ; Thu, 3 Oct 2024 18:58:16 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1swR0j-0000lT-3a; Thu, 03 Oct 2024 14:57:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1swR0h-0000l9-3L for qemu-devel@nongnu.org; Thu, 03 Oct 2024 14:57:11 -0400 Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swR0f-0003Iz-1t for qemu-devel@nongnu.org; Thu, 03 Oct 2024 14:57:10 -0400 Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2fac3f20f1dso15633861fa.3 for ; Thu, 03 Oct 2024 11:57:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727981827; x=1728586627; darn=nongnu.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=gGqqG4KMNUSJeDEYGOTuWNkgrn+DA19mS0ISFTxuLo8=; b=gSRDFhNJq27AWBSMB7E0WfvDN6q1O83g2yX8nZAsL/MJQ7KOG98/JPekQTYg8V2mTR 3BCvUp668BuuMd2gH++LZJLnU7hp2Rhubbfen390okySdF7HK7QOO/agPBIoZ9KjYcmt nLn4nEz4ATyfTCVg77G1srFe66M+LzhnVg7/uBUOFoNKL6pTVEfBhr1lrWOJNe/FgWtB q05QnAHFbLLwCdvRfiP8d6s7RlrFQyUH0AjSWBqSwtCuxhljzDROuD6C3g6iwm05P+WG oO9f6YM2rPZyaXRJmLwWz0HP9k2fmOOVtKmMoKXK+2ffkosro+yyo1Cf+9IvzNaPwEbe ADkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727981827; x=1728586627; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gGqqG4KMNUSJeDEYGOTuWNkgrn+DA19mS0ISFTxuLo8=; b=DXoaAee0PeNaMeQtBd6xzY+raVx4GBc8J2HcbiC2AktlRibJYhOB49+vuLuU68Gdkn b41Y3pa9tvRwlAaMtupi4PCE1DQQ6JVNZ+0yyWJhCsONtjRwB4u16DGP9I2jooI6lpO2 YscPib0cdTvVf/zIiZmCS0xnBZB6tIKZZO4rgu/RI6wZEN3b2i4NVI/LU2Q+IHqNzsdW rh4tNaCzvTuy1uYdghU5WO8+rH1jyBd0cUOEUrY0mufVuZwozA6yzA35QQt266a06/Pm bBqUf8JC2hQrjqjMUTpSCztQ4HJz3Qag18PtziM/hPcRfAviBdshwIVQZ9EQ3LPBdFTK eoDg== X-Gm-Message-State: AOJu0YzALlWHomhUTxslaMjVZJQypWZcErVoPtxoxfAp8VKEB5BOM/Cu 2SvmetM0FSFnU9qiuPwr+quZiCNNnSfi6/GCdaUd1nuHUtLIEv4+QhgJHG9d X-Google-Smtp-Source: AGHT+IHLTEkfckUGGKRvcplbeYVmPhK1mXleMIddN5HE0TGjyz0xJQGcVibsOAd0AKBA95Aqv2gqjg== X-Received: by 2002:a05:6512:a96:b0:52c:8979:9627 with SMTP id 2adb3069b0e04-539ab84a43cmr239526e87.3.1727981826784; Thu, 03 Oct 2024 11:57:06 -0700 (PDT) Received: from gmail.com (213-67-3-247-no600.tbcn.telia.com. [213.67.3.247]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539a82a3977sm236219e87.210.2024.10.03.11.57.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Oct 2024 11:57:05 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Cc: sstabellini@kernel.org, anthony@xenproject.org, paul@xen.org, peter.maydell@linaro.org, edgar.iglesias@amd.com, xen-devel@lists.xenproject.org, "Edgar E. Iglesias" , Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum Subject: [PULL v2 2/5] hw/xen: Expose handle_bufioreq in xen_register_ioreq Date: Thu, 3 Oct 2024 20:56:51 +0200 Message-ID: <20241003185655.1480819-3-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241003185655.1480819-1-edgar.iglesias@gmail.com> References: <20241003185655.1480819-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::230; envelope-from=edgar.iglesias@gmail.com; helo=mail-lj1-x230.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_FILL_THIS_FORM_SHORT=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: "Edgar E. Iglesias" Expose handle_bufioreq in xen_register_ioreq(). This is to allow machines to enable or disable buffered ioreqs. No functional change since all callers still set it to HVM_IOREQSRV_BUFIOREQ_ATOMIC. Reviewed-by: Stefano Stabellini Signed-off-by: Edgar E. Iglesias --- hw/i386/xen/xen-hvm.c | 4 +- hw/xen/xen-hvm-common.c | 100 ++++++++++++++++++++------------ hw/xen/xen-pvh-common.c | 4 +- include/hw/xen/xen-hvm-common.h | 3 + include/hw/xen/xen_native.h | 3 +- 5 files changed, 73 insertions(+), 41 deletions(-) diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c index 4f6446600c..d3df488c48 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -614,7 +614,9 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory) state = g_new0(XenIOState, 1); - xen_register_ioreq(state, max_cpus, &xen_memory_listener); + xen_register_ioreq(state, max_cpus, + HVM_IOREQSRV_BUFIOREQ_ATOMIC, + &xen_memory_listener); xen_is_stubdomain = xen_check_stubdomain(state->xenstore); diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c index 3a9d6f981b..7d2b72853b 100644 --- a/hw/xen/xen-hvm-common.c +++ b/hw/xen/xen-hvm-common.c @@ -667,6 +667,8 @@ static int xen_map_ioreq_server(XenIOState *state) xen_pfn_t ioreq_pfn; xen_pfn_t bufioreq_pfn; evtchn_port_t bufioreq_evtchn; + unsigned long num_frames = 1; + unsigned long frame = 1; int rc; /* @@ -675,59 +677,78 @@ static int xen_map_ioreq_server(XenIOState *state) */ QEMU_BUILD_BUG_ON(XENMEM_resource_ioreq_server_frame_bufioreq != 0); QEMU_BUILD_BUG_ON(XENMEM_resource_ioreq_server_frame_ioreq(0) != 1); + + if (state->has_bufioreq) { + frame = 0; + num_frames = 2; + } state->fres = xenforeignmemory_map_resource(xen_fmem, xen_domid, XENMEM_resource_ioreq_server, - state->ioservid, 0, 2, + state->ioservid, + frame, num_frames, &addr, PROT_READ | PROT_WRITE, 0); if (state->fres != NULL) { trace_xen_map_resource_ioreq(state->ioservid, addr); - state->buffered_io_page = addr; - state->shared_page = addr + XC_PAGE_SIZE; + state->shared_page = addr; + if (state->has_bufioreq) { + state->buffered_io_page = addr; + state->shared_page = addr + XC_PAGE_SIZE; + } } else if (errno != EOPNOTSUPP) { error_report("failed to map ioreq server resources: error %d handle=%p", errno, xen_xc); return -1; } - rc = xen_get_ioreq_server_info(xen_domid, state->ioservid, - (state->shared_page == NULL) ? - &ioreq_pfn : NULL, - (state->buffered_io_page == NULL) ? - &bufioreq_pfn : NULL, - &bufioreq_evtchn); - if (rc < 0) { - error_report("failed to get ioreq server info: error %d handle=%p", - errno, xen_xc); - return rc; - } + /* + * If we fail to map the shared page with xenforeignmemory_map_resource() + * or if we're using buffered ioreqs, we need xen_get_ioreq_server_info() + * to provide the the addresses to map the shared page and/or to get the + * event-channel port for buffered ioreqs. + */ + if (state->shared_page == NULL || state->has_bufioreq) { + rc = xen_get_ioreq_server_info(xen_domid, state->ioservid, + (state->shared_page == NULL) ? + &ioreq_pfn : NULL, + (state->has_bufioreq && + state->buffered_io_page == NULL) ? + &bufioreq_pfn : NULL, + &bufioreq_evtchn); + if (rc < 0) { + error_report("failed to get ioreq server info: error %d handle=%p", + errno, xen_xc); + return rc; + } - if (state->shared_page == NULL) { - trace_xen_map_ioreq_server_shared_page(ioreq_pfn); + if (state->shared_page == NULL) { + trace_xen_map_ioreq_server_shared_page(ioreq_pfn); - state->shared_page = xenforeignmemory_map(xen_fmem, xen_domid, - PROT_READ | PROT_WRITE, - 1, &ioreq_pfn, NULL); + state->shared_page = xenforeignmemory_map(xen_fmem, xen_domid, + PROT_READ | PROT_WRITE, + 1, &ioreq_pfn, NULL); + } if (state->shared_page == NULL) { error_report("map shared IO page returned error %d handle=%p", errno, xen_xc); } - } - if (state->buffered_io_page == NULL) { - trace_xen_map_ioreq_server_buffered_io_page(bufioreq_pfn); + if (state->has_bufioreq && state->buffered_io_page == NULL) { + trace_xen_map_ioreq_server_buffered_io_page(bufioreq_pfn); - state->buffered_io_page = xenforeignmemory_map(xen_fmem, xen_domid, - PROT_READ | PROT_WRITE, - 1, &bufioreq_pfn, - NULL); - if (state->buffered_io_page == NULL) { - error_report("map buffered IO page returned error %d", errno); - return -1; + state->buffered_io_page = xenforeignmemory_map(xen_fmem, xen_domid, + PROT_READ | PROT_WRITE, + 1, &bufioreq_pfn, + NULL); + if (state->buffered_io_page == NULL) { + error_report("map buffered IO page returned error %d", errno); + return -1; + } } } - if (state->shared_page == NULL || state->buffered_io_page == NULL) { + if (state->shared_page == NULL || + (state->has_bufioreq && state->buffered_io_page == NULL)) { return -1; } @@ -830,14 +851,15 @@ static void xen_do_ioreq_register(XenIOState *state, state->ioreq_local_port[i] = rc; } - rc = qemu_xen_evtchn_bind_interdomain(state->xce_handle, xen_domid, - state->bufioreq_remote_port); - if (rc == -1) { - error_report("buffered evtchn bind error %d", errno); - goto err; + if (state->has_bufioreq) { + rc = qemu_xen_evtchn_bind_interdomain(state->xce_handle, xen_domid, + state->bufioreq_remote_port); + if (rc == -1) { + error_report("buffered evtchn bind error %d", errno); + goto err; + } + state->bufioreq_local_port = rc; } - state->bufioreq_local_port = rc; - /* Init RAM management */ #ifdef XEN_COMPAT_PHYSMAP xen_map_cache_init(xen_phys_offset_to_gaddr, state); @@ -865,6 +887,7 @@ err: } void xen_register_ioreq(XenIOState *state, unsigned int max_cpus, + uint8_t handle_bufioreq, const MemoryListener *xen_memory_listener) { int rc; @@ -883,7 +906,8 @@ void xen_register_ioreq(XenIOState *state, unsigned int max_cpus, goto err; } - rc = xen_create_ioreq_server(xen_domid, &state->ioservid); + state->has_bufioreq = handle_bufioreq != HVM_IOREQSRV_BUFIOREQ_OFF; + rc = xen_create_ioreq_server(xen_domid, handle_bufioreq, &state->ioservid); if (!rc) { xen_do_ioreq_register(state, max_cpus, xen_memory_listener); } else { diff --git a/hw/xen/xen-pvh-common.c b/hw/xen/xen-pvh-common.c index 28d7168446..08641fdcec 100644 --- a/hw/xen/xen-pvh-common.c +++ b/hw/xen/xen-pvh-common.c @@ -194,7 +194,9 @@ static void xen_pvh_init(MachineState *ms) } xen_pvh_init_ram(s, sysmem); - xen_register_ioreq(&s->ioreq, ms->smp.max_cpus, &xen_memory_listener); + xen_register_ioreq(&s->ioreq, ms->smp.max_cpus, + HVM_IOREQSRV_BUFIOREQ_ATOMIC, + &xen_memory_listener); 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-common.h index 3d796235dc..0f586c4384 100644 --- a/include/hw/xen/xen-hvm-common.h +++ b/include/hw/xen/xen-hvm-common.h @@ -81,6 +81,8 @@ typedef struct XenIOState { QLIST_HEAD(, XenPciDevice) dev_list; DeviceListener device_listener; + bool has_bufioreq; + Notifier exit; } XenIOState; @@ -95,6 +97,7 @@ void xen_device_unrealize(DeviceListener *listener, DeviceState *dev); void xen_hvm_change_state_handler(void *opaque, bool running, RunState rstate); void xen_register_ioreq(XenIOState *state, unsigned int max_cpus, + uint8_t handle_bufioreq, const MemoryListener *xen_memory_listener); void cpu_ioreq_pio(ioreq_t *req); diff --git a/include/hw/xen/xen_native.h b/include/hw/xen/xen_native.h index 1a5ad693a4..5caf91a616 100644 --- a/include/hw/xen/xen_native.h +++ b/include/hw/xen/xen_native.h @@ -464,10 +464,11 @@ static inline void xen_unmap_pcidev(domid_t dom, } static inline int xen_create_ioreq_server(domid_t dom, + int handle_bufioreq, ioservid_t *ioservid) { int rc = xendevicemodel_create_ioreq_server(xen_dmod, dom, - HVM_IOREQSRV_BUFIOREQ_ATOMIC, + handle_bufioreq, ioservid); if (rc == 0) { From patchwork Thu Oct 3 18:56:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 13821428 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 63198CF34BE for ; Thu, 3 Oct 2024 18:58:33 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1swR0n-0000mO-JB; Thu, 03 Oct 2024 14:57:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1swR0j-0000lV-Db; Thu, 03 Oct 2024 14:57:13 -0400 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swR0h-0003JS-K1; Thu, 03 Oct 2024 14:57:13 -0400 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2f7657f9f62so13922091fa.3; Thu, 03 Oct 2024 11:57:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727981829; x=1728586629; darn=nongnu.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=G14n863A5XJ+R3OWZM+ShGFWWx326n2e7KMDwbqTXOk=; b=TyMzGz+45A+2ao9S+4QZSrdsSmQSotMitGvcq3LX1WLGwBrE2gJPmpD7btiHM4n2Xn lEg1lypUtouzqhmOzXQ0lGDHVANEfMKeYiZEN8wPms22N/iC4SoUgoiSFVgSALPIKfVh 8bgAAPIJ/isT7D5sNmJJGkL6IEziOfTN0GSzMchHA269gdIT1C78+Dbwjee9zD4tl8uo xCKAhCH4TlqiT5MXaOH5pJnAnf7kS4Z4YqrG7MhTuY4McvefYNNLOq7QPI1HQDkwX34d XoXsramfPRbA+pT6wMFnY0CyGmyH6SYbKkoBlYpj67gXDQa3+ObjNN1WhOJPTBxr5evl DeFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727981829; x=1728586629; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G14n863A5XJ+R3OWZM+ShGFWWx326n2e7KMDwbqTXOk=; b=l0ngi4aQoSgjVMtp++OnRyBtlZlCcbk4yUxd/ius6DlcLIoAMbMCwBP5XP040AjKee HS4Gu1jQU+0oOD8+Mn8sg/f5lKnrjDkHYCJe7OTqCshJFmP6bnubzoP5ipNK/7yW8iFb 8uvUhE/2fDxhQUYna57kbyaSMi4sncIXjQCQKQYQrSY9oGNal5eRA8BiejFQ649uhoGp buu42Z9d+6ouuo6BSPNT05OKgqdyQGxx+lxlU38iQrlLGcl7S+dPrdo0T7z2V4ehyNAR eLQAJWWWNtIydKGNUvE5EjEtdbO59n46Xab64wLwHsvm2pj2Y8uGTdY2QiGw+fE8SCNc yYAg== X-Forwarded-Encrypted: i=1; AJvYcCXXvI5gsmuzjNKqDLGnyCYhge2z1GlR8d8cTShb3pEXOnklrscdle1WRmeiUg7dRRQ2hTIqGVbDuw==@nongnu.org X-Gm-Message-State: AOJu0YzXU3E6WYbinxkj0kYDik7R3hubfZsktmSS9ZYtiMD8U8nX6ke5 LB2e6J79M6VDWwe4eDPbgWX71UXNSV89EIcIMLk2Gy6LYjS4wfYn727Xmnl3 X-Google-Smtp-Source: AGHT+IGQBj0NQJQro7UzQrosv5xSzNbo69XNoBKLZB/U0eu07okLlmd7xHxmDysYwKwHtl0qaDQP6Q== X-Received: by 2002:a2e:a543:0:b0:2fa:c5e5:629d with SMTP id 38308e7fff4ca-2faf3c1404bmr240971fa.3.1727981828500; Thu, 03 Oct 2024 11:57:08 -0700 (PDT) Received: from gmail.com (213-67-3-247-no600.tbcn.telia.com. [213.67.3.247]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2faecc6c18dsm2772521fa.97.2024.10.03.11.57.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Oct 2024 11:57:07 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Cc: sstabellini@kernel.org, anthony@xenproject.org, paul@xen.org, peter.maydell@linaro.org, edgar.iglesias@amd.com, xen-devel@lists.xenproject.org, "Edgar E. Iglesias" , Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , qemu-arm@nongnu.org Subject: [PULL v2 3/5] hw/xen: xenpvh: Disable buffered IOREQs for ARM Date: Thu, 3 Oct 2024 20:56:52 +0200 Message-ID: <20241003185655.1480819-4-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241003185655.1480819-1-edgar.iglesias@gmail.com> References: <20241003185655.1480819-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22f; envelope-from=edgar.iglesias@gmail.com; helo=mail-lj1-x22f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: "Edgar E. Iglesias" Add a way to enable/disable buffered IOREQs for PVH machines and disable them for ARM. ARM does not support buffered IOREQ's nor the legacy way to map IOREQ info pages. See the following for more details: https://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=2fbd7e609e1803ac5e5c26e22aa8e4b5a6cddbb1 https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/arch/arm/ioreq.c;h=2e829d2e7f3760401b96fa7c930e2015fb1cf463;hb=HEAD#l138 Reviewed-by: Stefano Stabellini Signed-off-by: Edgar E. Iglesias --- hw/arm/xen-pvh.c | 3 +++ hw/i386/xen/xen-pvh.c | 3 +++ hw/xen/xen-pvh-common.c | 2 +- include/hw/xen/xen-pvh-common.h | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/arm/xen-pvh.c b/hw/arm/xen-pvh.c index 04cb9855af..28af3910ea 100644 --- a/hw/arm/xen-pvh.c +++ b/hw/arm/xen-pvh.c @@ -66,6 +66,9 @@ static void xen_arm_machine_class_init(ObjectClass *oc, void *data) */ mc->max_cpus = GUEST_MAX_VCPUS; + /* Xen/ARM does not use buffered IOREQs. */ + xpc->handle_bufioreq = HVM_IOREQSRV_BUFIOREQ_OFF; + /* List of supported features known to work on PVH ARM. */ xpc->has_tpm = true; xpc->has_virtio_mmio = true; diff --git a/hw/i386/xen/xen-pvh.c b/hw/i386/xen/xen-pvh.c index 45645667e9..f1f02d3311 100644 --- a/hw/i386/xen/xen-pvh.c +++ b/hw/i386/xen/xen-pvh.c @@ -89,6 +89,9 @@ static void xen_pvh_machine_class_init(ObjectClass *oc, void *data) /* We have an implementation specific init to create CPU objects. */ xpc->init = xen_pvh_init; + /* Enable buffered IOREQs. */ + xpc->handle_bufioreq = HVM_IOREQSRV_BUFIOREQ_ATOMIC; + /* * PCI INTX routing. * diff --git a/hw/xen/xen-pvh-common.c b/hw/xen/xen-pvh-common.c index 08641fdcec..76a9b2b945 100644 --- a/hw/xen/xen-pvh-common.c +++ b/hw/xen/xen-pvh-common.c @@ -195,7 +195,7 @@ static void xen_pvh_init(MachineState *ms) xen_pvh_init_ram(s, sysmem); xen_register_ioreq(&s->ioreq, ms->smp.max_cpus, - HVM_IOREQSRV_BUFIOREQ_ATOMIC, + xpc->handle_bufioreq, &xen_memory_listener); if (s->cfg.virtio_mmio_num) { diff --git a/include/hw/xen/xen-pvh-common.h b/include/hw/xen/xen-pvh-common.h index bc09eea936..5cdd23c2f4 100644 --- a/include/hw/xen/xen-pvh-common.h +++ b/include/hw/xen/xen-pvh-common.h @@ -43,6 +43,9 @@ struct XenPVHMachineClass { */ int (*set_pci_link_route)(uint8_t line, uint8_t irq); + /* Allow implementations to optionally enable buffered ioreqs. */ + uint8_t handle_bufioreq; + /* * Each implementation can optionally enable features that it * supports and are known to work. From patchwork Thu Oct 3 18:56:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 13821427 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 56D3FCF34BE for ; Thu, 3 Oct 2024 18:58:29 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1swR0o-0000mn-SH; Thu, 03 Oct 2024 14:57:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1swR0k-0000lv-Hv for qemu-devel@nongnu.org; Thu, 03 Oct 2024 14:57:14 -0400 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swR0i-0003Jk-Vd for qemu-devel@nongnu.org; Thu, 03 Oct 2024 14:57:14 -0400 Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2faccccbca7so12976921fa.2 for ; Thu, 03 Oct 2024 11:57:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727981831; x=1728586631; darn=nongnu.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=Mm+KI23c86LD33sZYRxxXCIhV12T/Ywht8Xuz1hXe+0=; b=bsnHDj5IZoNUuYxYYDz/o1AY+xOfdfnr1cPI5E1G/h0ClY1S6Z/unmmm/EQBQQ4BXn XoRhlQJzKmiMCbipsXhkJTUgPZuZCNqThQCddAFPbI2snUrviEf2y/I9VWRHBQRze7pN //aC/4UHYf4zlcmJbKofUV6k8XYfmpqg7iHFBK43oVS3zTFZBeJdtBZYprlG5xF/jZiR ZX0+Jthdb9XHMaYTUmzZ9iEZ22xeLLJ+FRskfAqz0tPsZzHkGTCpojcTjxemLSb+bqUA J8zYOxOsO6Y92wRhy+nSdOu4RhQhsfeOyGy8IN+nwWRC65jqAIsdzeWjJUw8iTeuBF7I L+bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727981831; x=1728586631; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Mm+KI23c86LD33sZYRxxXCIhV12T/Ywht8Xuz1hXe+0=; b=VVpphFv0SY+BLzV6cPcLISVoHXCcEemQ0LRhbefBWrm9cEtSYdbIM6gtVXXIMDPglk zGjMNzrsUNozu2PVdCPsrLFNgu5QN/8iW7IEinCiBQy+TJ+9e05CglcuQjxVtb26DFaB d0cZcfu+Cy7farDUOM6SyQdtmtwUC8XkReV7X/mlXlrxr+Buvs5ijCK2Ev+SxU5QhnsV ro9CtHH2oxwCzuaLO9nt4YYQYXal6FqtrhPrQmxe8QioVnMf/AkI4vWEwwR3yILJx++6 JH3Sc18ivtd7h2+PM/aFEc4I3VucjvqThNX1kIcYjkKqPV07Q7ZPwwj9No8M/5GnQmvR ujuw== X-Gm-Message-State: AOJu0Yw+q0p45x5nRti6PEBZ3IazdKpy7WeRi3SFO6QODAZnHTqBmYwl r+FvleRC1SbLiBKgavQP3MGS3WF+54fN6HWrpxE44lSlMUDspUCTP65qjHuE X-Google-Smtp-Source: AGHT+IE/e+F5VPNpTgi+p/cRxu4+PagJbnZ/GBiwrIy/ibjkQC9qwAlDuSB/1il5roTTxnglcO+Z8Q== X-Received: by 2002:a2e:be28:0:b0:2fa:bf53:1dad with SMTP id 38308e7fff4ca-2faf3d9d202mr113291fa.31.1727981830633; Thu, 03 Oct 2024 11:57:10 -0700 (PDT) Received: from gmail.com (213-67-3-247-no600.tbcn.telia.com. [213.67.3.247]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2faecbf63eesm2692971fa.27.2024.10.03.11.57.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Oct 2024 11:57:09 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Cc: sstabellini@kernel.org, anthony@xenproject.org, paul@xen.org, peter.maydell@linaro.org, edgar.iglesias@amd.com, xen-devel@lists.xenproject.org, "Edgar E. Iglesias" Subject: [PULL v2 4/5] hw/xen: xenpvh: Add pci-intx-irq-base property Date: Thu, 3 Oct 2024 20:56:53 +0200 Message-ID: <20241003185655.1480819-5-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241003185655.1480819-1-edgar.iglesias@gmail.com> References: <20241003185655.1480819-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::234; envelope-from=edgar.iglesias@gmail.com; helo=mail-lj1-x234.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: "Edgar E. Iglesias" Acked-by: Stefano Stabellini Signed-off-by: Edgar E. Iglesias --- hw/xen/xen-pvh-common.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/hw/xen/xen-pvh-common.c b/hw/xen/xen-pvh-common.c index 76a9b2b945..218ac851cf 100644 --- a/hw/xen/xen-pvh-common.c +++ b/hw/xen/xen-pvh-common.c @@ -218,6 +218,11 @@ static void xen_pvh_init(MachineState *ms) error_report("pci-ecam-size only supports values 0 or 0x10000000"); exit(EXIT_FAILURE); } + if (!s->cfg.pci_intx_irq_base) { + error_report("PCI enabled but pci-intx-irq-base not set"); + exit(EXIT_FAILURE); + } + xenpvh_gpex_init(s, xpc, sysmem); } @@ -273,6 +278,30 @@ XEN_PVH_PROP_MEMMAP(pci_ecam) XEN_PVH_PROP_MEMMAP(pci_mmio) XEN_PVH_PROP_MEMMAP(pci_mmio_high) +static void xen_pvh_set_pci_intx_irq_base(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + XenPVHMachineState *xp = XEN_PVH_MACHINE(obj); + uint32_t value; + + if (!visit_type_uint32(v, name, &value, errp)) { + return; + } + + xp->cfg.pci_intx_irq_base = value; +} + +static void xen_pvh_get_pci_intx_irq_base(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + XenPVHMachineState *xp = XEN_PVH_MACHINE(obj); + uint32_t value = xp->cfg.pci_intx_irq_base; + + visit_type_uint32(v, name, &value, errp); +} + void xen_pvh_class_setup_common_props(XenPVHMachineClass *xpc) { ObjectClass *oc = OBJECT_CLASS(xpc); @@ -318,6 +347,13 @@ do { \ OC_MEMMAP_PROP(oc, "pci-ecam", pci_ecam); OC_MEMMAP_PROP(oc, "pci-mmio", pci_mmio); OC_MEMMAP_PROP(oc, "pci-mmio-high", pci_mmio_high); + + object_class_property_add(oc, "pci-intx-irq-base", "uint32_t", + xen_pvh_get_pci_intx_irq_base, + xen_pvh_set_pci_intx_irq_base, + NULL, NULL); + object_class_property_set_description(oc, "pci-intx-irq-base", + "Set PCI INTX interrupt base line."); } #ifdef CONFIG_TPM From patchwork Thu Oct 3 18:56:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 13821429 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 63F1ECF34BE for ; Thu, 3 Oct 2024 18:58:44 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1swR0s-0000nH-3C; Thu, 03 Oct 2024 14:57:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1swR0n-0000mN-8U; Thu, 03 Oct 2024 14:57:17 -0400 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swR0l-0003Jz-2U; Thu, 03 Oct 2024 14:57:16 -0400 Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2fac63abf63so15452061fa.1; Thu, 03 Oct 2024 11:57:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727981832; x=1728586632; darn=nongnu.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=7NqZgDSIdmym8k9v4wrElx9POiJdcsjS85l4BMSFw2Y=; b=NSgjaM1edaz9MFceqbDunFyA+WRG+jmdv2EvgYiw16oexOHKrK5/0N5jyjomGEG3eq DOFEda1ucm0BUBzA7mByyq3Idha9hINZlqs0lsOCWbBcSPsWNskuQSfdEc+b2OVu/dbJ CJQzwPj6RRi89g5NbEHCp13v9Rzhy0C4gYRuOwb6WBQOhwOQKq0JSCyeEh/sI18adegu nHJbodaNmCGLA7EXhxLRokFhgGZPCsakmxNV8jrtaM9ni/RuBm1ZxfszS3ELwQE1TZGu pXtisFxkAbvrq9pk6jZ8cB65p66dzxYfMPibKmc8RmpRGBzJeZTPvkLbaK3CSjWtCu3F dhdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727981832; x=1728586632; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7NqZgDSIdmym8k9v4wrElx9POiJdcsjS85l4BMSFw2Y=; b=DDdDC2eI0UwdLjdAnVHxRJHLub6fEx0u56MdT9F2SyFgrcMUTcP830WdoQhy6FaBOR hxzFESimcmo4IoQB9Tl//WpQW1WVDKIO3BNrvVSv3jRUGWW1hndBTzpE889RbO1Mb+lS FVqC9GR2AbtriZ+9GJUlcpRf7SlW7TPZPAfJwdQLKdbfFwP6oI1iv608+/dDJKvMnwXd Ee3/+T6td/NeKxlSIweFHjzbCOMdxFe//GNfJfi6DMIR+z6hkcHPZpP+e+WwGl/Y5Z8P ZL2LpYye6OgjU2xjSgJcyMUphDFWD/t7bSd8lwceBA0we+/gIJbsj2LyV6DCFDsFDoXi qwSw== X-Forwarded-Encrypted: i=1; AJvYcCXrv70LIPwtZrbVh+tnUf4U0OsjqKzojwprtiOCkEi33MyaRxDsE6syjspy7gY2+xt52/3j8jnzxg==@nongnu.org X-Gm-Message-State: AOJu0YzY7ahEstiIUy1wME1aWBQMoMFjYPydDsZ5SFFTyJOO+nl+y/gp KjwlPf54YLsi1hVzxwz63+y0H94NVZud/i1xRRd53HQvyt/S6kvYd95Q4bYF X-Google-Smtp-Source: AGHT+IGdtsrhdXwp14pMpvdvc+CdpPcIPMIZgK2C81T/sez5hURdlMZpHD5usN8FxM0Nz2NV9uyp/Q== X-Received: by 2002:a2e:be20:0:b0:2f5:2ba:2c99 with SMTP id 38308e7fff4ca-2faf3c1400cmr307781fa.9.1727981832153; Thu, 03 Oct 2024 11:57:12 -0700 (PDT) Received: from gmail.com (213-67-3-247-no600.tbcn.telia.com. [213.67.3.247]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2faecc13b2asm2706361fa.69.2024.10.03.11.57.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Oct 2024 11:57:11 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Cc: sstabellini@kernel.org, anthony@xenproject.org, paul@xen.org, peter.maydell@linaro.org, edgar.iglesias@amd.com, xen-devel@lists.xenproject.org, qemu-arm@nongnu.org Subject: [PULL v2 5/5] hw/arm: xenpvh: Enable PCI for ARM PVH Date: Thu, 3 Oct 2024 20:56:54 +0200 Message-ID: <20241003185655.1480819-6-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241003185655.1480819-1-edgar.iglesias@gmail.com> References: <20241003185655.1480819-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::235; envelope-from=edgar.iglesias@gmail.com; helo=mail-lj1-x235.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: "Edgar E. Iglesias" Enable PCI support for the ARM Xen PVH machine. Reviewed-by: Stefano Stabellini Signed-off-by: Edgar E. Iglesias --- hw/arm/xen-pvh.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/hw/arm/xen-pvh.c b/hw/arm/xen-pvh.c index 28af3910ea..33f0dd5982 100644 --- a/hw/arm/xen-pvh.c +++ b/hw/arm/xen-pvh.c @@ -39,6 +39,16 @@ static void xen_arm_instance_init(Object *obj) VIRTIO_MMIO_DEV_SIZE }; } +static void xen_pvh_set_pci_intx_irq(void *opaque, int intx_irq, int level) +{ + XenPVHMachineState *s = XEN_PVH_MACHINE(opaque); + int irq = s->cfg.pci_intx_irq_base + intx_irq; + + if (xendevicemodel_set_irq_level(xen_dmod, xen_domid, irq, level)) { + error_report("xendevicemodel_set_pci_intx_level failed"); + } +} + static void xen_arm_machine_class_init(ObjectClass *oc, void *data) { XenPVHMachineClass *xpc = XEN_PVH_MACHINE_CLASS(oc); @@ -69,7 +79,11 @@ static void xen_arm_machine_class_init(ObjectClass *oc, void *data) /* Xen/ARM does not use buffered IOREQs. */ xpc->handle_bufioreq = HVM_IOREQSRV_BUFIOREQ_OFF; + /* PCI INTX delivery. */ + xpc->set_pci_intx_irq = xen_pvh_set_pci_intx_irq; + /* List of supported features known to work on PVH ARM. */ + xpc->has_pci = true; xpc->has_tpm = true; xpc->has_virtio_mmio = true;