From nobody Thu Nov 21 21:57:17 2024 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=1727981861; cv=none; d=zohomail.com; s=zohoarc; b=gKsCpraHnDFbONVDMpKR5BH9QaWwVVi66bqPwVEvhSFGUYcdSyEavueVPGNJO1AYUEOpjNbUvf+WvkzY086Th+b2GJ9nKmKUyaGiO3PXuBC1SA57zylZYPvVo3P3zWJWExKmKwchaJutZPObe8v7U/JtrV+KPIpl8gCvUXLCytk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727981861; 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=5QkDAThvHzn8nk+HGJi0H/5a08f7RDTFwzrMcXuWa4E=; b=hSKnJrH/QhAMb99rEbN8X0XXCzEzuVOFHusmvn5kDoqsW+3QlPorjWEIApVeZeOC73VOcbip4Q/fj3KSLf4nZ0fmfKONkGlvNXqEReb2+D99GVizN8NzxOc0ciO3tAV7b0F/TO7Tko+kIoqYR1yO2V9LhigEe1XNMH05GavSGNg= 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 1727981861119259.65065767618444; Thu, 3 Oct 2024 11:57:41 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.809818.1222356 (Exim 4.92) (envelope-from ) id 1swR0d-0007nP-2V; Thu, 03 Oct 2024 18:57:07 +0000 Received: by outflank-mailman (output) from mailman id 809818.1222356; Thu, 03 Oct 2024 18:57:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1swR0c-0007nI-W9; Thu, 03 Oct 2024 18:57:06 +0000 Received: by outflank-mailman (input) for mailman id 809818; Thu, 03 Oct 2024 18:57:05 +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 1swR0b-0007Yu-SU for xen-devel@lists.xenproject.org; Thu, 03 Oct 2024 18:57:05 +0000 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [2a00:1450:4864:20::12d]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 4840cf42-81b9-11ef-a0ba-8be0dac302b0; Thu, 03 Oct 2024 20:57:05 +0200 (CEST) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-5399041167cso2277775e87.0 for ; Thu, 03 Oct 2024 11:57:05 -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) 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: 4840cf42-81b9-11ef-a0ba-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727981825; x=1728586625; 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=5QkDAThvHzn8nk+HGJi0H/5a08f7RDTFwzrMcXuWa4E=; b=SrI1hVTlLwfC+637UQhhV2LuZAMFGVnfVVVrRwBK5e0G6GFNbEikqpPWw+jCN6JuwJ sf2CiBNOs2Db+KDeyHvtmWdUfjTjGaGFqIOdr5ZYzCK2mYvw5SfLP1pwEduFicnnjBL9 nrCYFIe3zsPCxRfUF0IiT9Sb20DZY+6GMF1Itrj+wJTVH3qjMimvMmArvESRiTDAX7SY BmyKDTQgXEK1us4URnzFRIpJ7y5wrgJ3i31VTXUDI1PsS91uqdtRmLO46N4FV7lwMjY/ 0cThhib8k/AvOfujRJLP4d5TyK4dj6qRR92ELG4vSlqtbnt209/KDDrlAm2Rp/aM6VKI Ys9g== 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=gJB7+ZqAttJK992nOA10pDrr36MYgo5bnlsFTIJr3FkTT0zMmrvWUieRrcdCQq17VV 4J4HCvHOMqO5yfh0x4Fa5tDW9UpKLeHaMNXES0H5FpXyh89vFabH20Cn6r61PvkdrAhg AJTZQne49nG7FiMj4GielcSzo/spjgE2dXer9wgd0mIaPyalrFarQNGUe9Od2meW/CQm zQJVbpZN0F0KUbn5xMzkfB5ymX4oHEqG5orE2yNfOgPVBYjZyVlWntZtFrMok9+TRxFv I66Lw9xp5za8UIyWoSlolJ6wtxpHmdrxQgJK0XaGNION9zojghs5IofFPa3hokFbVlwV BlMg== X-Forwarded-Encrypted: i=1; AJvYcCU1Iwi4rwH7EaUOEeHz1/MAsXZ4YN8gdYMi2cNl8xRks9tRgtqyoPAZbSZlzCEIRQRNyAm507vAOco=@lists.xenproject.org X-Gm-Message-State: AOJu0Yx5B+JG2rOhtjZKvedYZU754YwHJ1cUF86YFDvAl3xa78FSOECw F5TBBkDBvlZpJUT6J0BWps2WjNf4ZH6vT+euwsspdAXcgOnRDdiA 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) 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 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1727981863057116600 Content-Type: text/plain; charset="utf-8" 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 *x= endev, void *ptr, } } =20 -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 =3D qemu_xen_gnttab_grant_copy(xendev->gnttabdev, to_domain, xen_do= mid, - 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-legac= y-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 *xend= ev, uint32_t *refs, void xen_be_unmap_grant_refs(struct XenLegacyDevice *xendev, void *ptr, uint32_t *refs, unsigned int nr_refs); =20 -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 XenLegac= yDevice *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); =20 #endif /* HW_XEN_LEGACY_BACKEND_H */ --=20 2.43.0 From nobody Thu Nov 21 21:57:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1727981896; cv=none; d=zohomail.com; s=zohoarc; b=Pqm/rLx1KZGDvzmmnXJjYwS19ORMS+9/43FdVIEBzqQItaygZ3NAox1WfTgwxMR0nGVt0xnFTLKEDKO0MuHsGjKw0v/0Jg+4cvgZp5DRjfykheDbmqDD987blTVWuIDZsSyBqdBfafig3FGjypKB/hqBt0LSWNAfTOLssmZvqUc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727981896; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gGqqG4KMNUSJeDEYGOTuWNkgrn+DA19mS0ISFTxuLo8=; b=nLC32lW+XkqUpQ9k0FvjBZ989XRCBzbT76JkHF1fiIekkuezCieKs+OtOSg2AjRk+HwAXrNONYYIaTOrHHFrj8o0EQH8zjJXG+tR10dY5e01Scrx97P5mEUEPHWTd75kqzaaPQlmbDUrjeS5C55gSjYRBxSaBjMu1z+IVfl6j4s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1727981896679824.9355755917356; Thu, 3 Oct 2024 11:58:16 -0700 (PDT) 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) 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) 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1727981899223116600 Content-Type: text/plain; charset="utf-8" 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) =20 state =3D g_new0(XenIOState, 1); =20 - xen_register_ioreq(state, max_cpus, &xen_memory_listener); + xen_register_ioreq(state, max_cpus, + HVM_IOREQSRV_BUFIOREQ_ATOMIC, + &xen_memory_listener); =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 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 =3D 1; + unsigned long frame =3D 1; int rc; =20 /* @@ -675,59 +677,78 @@ static int xen_map_ioreq_server(XenIOState *state) */ QEMU_BUILD_BUG_ON(XENMEM_resource_ioreq_server_frame_bufioreq !=3D 0); QEMU_BUILD_BUG_ON(XENMEM_resource_ioreq_server_frame_ioreq(0) !=3D 1); + + if (state->has_bufioreq) { + frame =3D 0; + num_frames =3D 2; + } state->fres =3D 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 !=3D NULL) { trace_xen_map_resource_ioreq(state->ioservid, addr); - state->buffered_io_page =3D addr; - state->shared_page =3D addr + XC_PAGE_SIZE; + state->shared_page =3D addr; + if (state->has_bufioreq) { + state->buffered_io_page =3D addr; + state->shared_page =3D addr + XC_PAGE_SIZE; + } } else if (errno !=3D EOPNOTSUPP) { error_report("failed to map ioreq server resources: error %d handl= e=3D%p", errno, xen_xc); return -1; } =20 - rc =3D xen_get_ioreq_server_info(xen_domid, state->ioservid, - (state->shared_page =3D=3D NULL) ? - &ioreq_pfn : NULL, - (state->buffered_io_page =3D=3D NULL) ? - &bufioreq_pfn : NULL, - &bufioreq_evtchn); - if (rc < 0) { - error_report("failed to get ioreq server info: error %d handle=3D%= p", - errno, xen_xc); - return rc; - } + /* + * If we fail to map the shared page with xenforeignmemory_map_resourc= e() + * or if we're using buffered ioreqs, we need xen_get_ioreq_server_inf= o() + * to provide the the addresses to map the shared page and/or to get t= he + * event-channel port for buffered ioreqs. + */ + if (state->shared_page =3D=3D NULL || state->has_bufioreq) { + rc =3D xen_get_ioreq_server_info(xen_domid, state->ioservid, + (state->shared_page =3D=3D NULL) ? + &ioreq_pfn : NULL, + (state->has_bufioreq && + state->buffered_io_page =3D=3D NUL= L) ? + &bufioreq_pfn : NULL, + &bufioreq_evtchn); + if (rc < 0) { + error_report("failed to get ioreq server info: error %d handle= =3D%p", + errno, xen_xc); + return rc; + } =20 - if (state->shared_page =3D=3D NULL) { - trace_xen_map_ioreq_server_shared_page(ioreq_pfn); + if (state->shared_page =3D=3D NULL) { + trace_xen_map_ioreq_server_shared_page(ioreq_pfn); =20 - state->shared_page =3D xenforeignmemory_map(xen_fmem, xen_domid, - PROT_READ | PROT_WRITE, - 1, &ioreq_pfn, NULL); + state->shared_page =3D xenforeignmemory_map(xen_fmem, xen_domi= d, + PROT_READ | PROT_WRI= TE, + 1, &ioreq_pfn, NULL); + } if (state->shared_page =3D=3D NULL) { error_report("map shared IO page returned error %d handle=3D%p= ", errno, xen_xc); } - } =20 - if (state->buffered_io_page =3D=3D NULL) { - trace_xen_map_ioreq_server_buffered_io_page(bufioreq_pfn); + if (state->has_bufioreq && state->buffered_io_page =3D=3D NULL) { + trace_xen_map_ioreq_server_buffered_io_page(bufioreq_pfn); =20 - state->buffered_io_page =3D xenforeignmemory_map(xen_fmem, xen_dom= id, - PROT_READ | PROT_WR= ITE, - 1, &bufioreq_pfn, - NULL); - if (state->buffered_io_page =3D=3D NULL) { - error_report("map buffered IO page returned error %d", errno); - return -1; + state->buffered_io_page =3D xenforeignmemory_map(xen_fmem, xen= _domid, + PROT_READ | PROT_W= RITE, + 1, &bufioreq_pfn, + NULL); + if (state->buffered_io_page =3D=3D NULL) { + error_report("map buffered IO page returned error %d", err= no); + return -1; + } } } =20 - if (state->shared_page =3D=3D NULL || state->buffered_io_page =3D=3D N= ULL) { + if (state->shared_page =3D=3D NULL || + (state->has_bufioreq && state->buffered_io_page =3D=3D NULL)) { return -1; } =20 @@ -830,14 +851,15 @@ static void xen_do_ioreq_register(XenIOState *state, state->ioreq_local_port[i] =3D rc; } =20 - rc =3D qemu_xen_evtchn_bind_interdomain(state->xce_handle, xen_domid, - state->bufioreq_remote_port); - if (rc =3D=3D -1) { - error_report("buffered evtchn bind error %d", errno); - goto err; + if (state->has_bufioreq) { + rc =3D qemu_xen_evtchn_bind_interdomain(state->xce_handle, xen_dom= id, + state->bufioreq_remote_port); + if (rc =3D=3D -1) { + error_report("buffered evtchn bind error %d", errno); + goto err; + } + state->bufioreq_local_port =3D rc; } - state->bufioreq_local_port =3D rc; - /* Init RAM management */ #ifdef XEN_COMPAT_PHYSMAP xen_map_cache_init(xen_phys_offset_to_gaddr, state); @@ -865,6 +887,7 @@ err: } =20 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; } =20 - rc =3D xen_create_ioreq_server(xen_domid, &state->ioservid); + 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); } 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) } =20 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); =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 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; =20 + bool has_bufioreq; + Notifier exit; } XenIOState; =20 @@ -95,6 +97,7 @@ void xen_device_unrealize(DeviceListener *listener, Devic= eState *dev); =20 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); =20 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, } =20 static inline int xen_create_ioreq_server(domid_t dom, + int handle_bufioreq, ioservid_t *ioservid) { int rc =3D xendevicemodel_create_ioreq_server(xen_dmod, dom, - HVM_IOREQSRV_BUFIOREQ_ATOM= IC, + handle_bufioreq, ioservid); =20 if (rc =3D=3D 0) { --=20 2.43.0 From nobody Thu Nov 21 21:57:17 2024 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=1727981859; cv=none; d=zohomail.com; s=zohoarc; b=Z+s2KpseSsuOp+2Q1EVgKP+OATUiGW89tQPNQwC86t1nYZ6LU2ZM55oHCyldm27o+eHW9Ni29cMp18ABFgYcfqwO+6FLDZnwWwOrPpbuxTWE7Y2o6NOrupO2QSgOVSRZ6u0NgJH8un0L9Qcek0iItpMY70XEPrpKP9eEPge8iC8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727981859; 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=G14n863A5XJ+R3OWZM+ShGFWWx326n2e7KMDwbqTXOk=; b=NTMlayIxkKp5FthcG7fgxDomGBH6eBALvtxyr2JqMBrTE+o/gLTSQ6KBvwc8omRq55pkdMgIgVo+TgnbkSFb3Bpcr8BVQ7SBR1hjwlDBQ0AI0Nrzmql2XGwlPAzhT7MxpRpFbO4ShIcKz5AbK5bTOQWbRRThRUu0rnpZV/GHek4= 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 1727981859093440.39343843813776; Thu, 3 Oct 2024 11:57:39 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.809820.1222371 (Exim 4.92) (envelope-from ) id 1swR0g-000873-Ng; Thu, 03 Oct 2024 18:57:10 +0000 Received: by outflank-mailman (output) from mailman id 809820.1222371; Thu, 03 Oct 2024 18:57:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1swR0g-00085w-Gl; Thu, 03 Oct 2024 18:57:10 +0000 Received: by outflank-mailman (input) for mailman id 809820; Thu, 03 Oct 2024 18:57:09 +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 1swR0f-0007Yu-Le for xen-devel@lists.xenproject.org; Thu, 03 Oct 2024 18:57:09 +0000 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [2a00:1450:4864:20::230]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 4a9200a3-81b9-11ef-a0ba-8be0dac302b0; Thu, 03 Oct 2024 20:57:09 +0200 (CEST) Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2fac787f39fso15854521fa.2 for ; Thu, 03 Oct 2024 11:57:09 -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) 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: 4a9200a3-81b9-11ef-a0ba-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727981829; x=1728586629; 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=G14n863A5XJ+R3OWZM+ShGFWWx326n2e7KMDwbqTXOk=; b=a99UYE7nXSpY1HYv37N0v6ZFjaqCg1L+nbTk4Clp515RUg7PoYcPE1fytyrPXfP449 23dlwgvU5UJyacXitdMK0sPCdW24F6RYpEjrI74DDAVLfOjFFYC/BiIPyOZnTyvTf8x3 PYWhV8Hw9rWjsx8w7GB+T8wfWTpm0qQK7wbmZn70+D8XnFe1nQFjxBFIRqgbTFK/V4iV YemhA0Pc+YiLUq9oDrx23h54EeMt5lh9MOJQQ2SmI6Z/Tp6VLxZRp90fNgeGkDkecPmj Zn8th1mAwy8LOTtP6XFVfy+wtFq/XGXWRdlWFUzqxseFMIWzN8Rb4w7P4LXpUow+y7Vc XnAQ== 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=ceSoRlaAVjVwX3ja4KWvx+q8j568+2K+A4niMyFlkoggvTbU+irPfQo16ghF0wXCNS yHM7OwGJa3YzSsv/lqqJ1A3TpQWaU+6ABQMixWi6GCZXZX/7ddwrwaFrFWEWMjGSirQb dgGay3MPwnEvoOexwP4u1UTSUlz5yx9GU8JCNNY2UYij4m1rG0zaC3UKo0ZHisd/+9aK 9Boj9fPpkUszKSCXoxnMsg9xI1nDwSc2eKP/x8hbHmpjbTxwuVLw8zQmv/8Gnixg/hVU IZ3hO9qOGvmzr1S10hF1E5gV4rrU0QhkSFOX64YbwrfXaYsZqaTXt925YWuTZGS3RDiY FhxA== X-Forwarded-Encrypted: i=1; AJvYcCVbbh7CdVMPbk0jak/jvu+RpPzplqzA3v+J0bzOjqj0+OXveUvO/MB+/e2cqJvMk8GvIqf37LWlyBM=@lists.xenproject.org X-Gm-Message-State: AOJu0YyRSqIJuNHKZ/KH8FgnuOAxuFRAbiOpNGp5tgaKOJSs0XBKR2Dh 2adFLlLLpYcTNtu9EbpI/nRdpLJdGHDqcZcQJ3PWAjEyf3gcVJVg 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) 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 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1727981861051116600 Content-Type: text/plain; charset="utf-8" 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=3Dxen.git;a=3Dcommitdiff;h=3D2fbd7e609e18= 03ac5e5c26e22aa8e4b5a6cddbb1 https://xenbits.xen.org/gitweb/?p=3Dxen.git;a=3Dblob;f=3Dxen/arch/arm/ioreq= .c;h=3D2e829d2e7f3760401b96fa7c930e2015fb1cf463;hb=3DHEAD#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, v= oid *data) */ mc->max_cpus =3D GUEST_MAX_VCPUS; =20 + /* Xen/ARM does not use buffered IOREQs. */ + xpc->handle_bufioreq =3D HVM_IOREQSRV_BUFIOREQ_OFF; + /* List of supported features known to work on PVH ARM. */ xpc->has_tpm =3D true; xpc->has_virtio_mmio =3D 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, v= oid *data) /* We have an implementation specific init to create CPU objects. */ xpc->init =3D xen_pvh_init; =20 + /* Enable buffered IOREQs. */ + xpc->handle_bufioreq =3D 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) =20 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); =20 if (s->cfg.virtio_mmio_num) { diff --git a/include/hw/xen/xen-pvh-common.h b/include/hw/xen/xen-pvh-commo= n.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); =20 + /* 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. --=20 2.43.0 From nobody Thu Nov 21 21:57:17 2024 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=1727981863; cv=none; d=zohomail.com; s=zohoarc; b=GIqEmXuI59g7UgaPif+DDa3tcdi+isnq8olBmBgy80XyX1cg4gR7yhSV6mULS5H2tzlqyNy9nVA+e6HDIWfNhux+br0NeMRAeaZmaIqelzz6Nn/R9oXj7zMIzScPvEWSTn5P9xUHOblyNNp6cqCCQZ489ddykCsOh4zFdTuKZV0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727981863; 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=Mm+KI23c86LD33sZYRxxXCIhV12T/Ywht8Xuz1hXe+0=; b=U1WXvp4MqOT7IG8Amd8HhO+MvQ9HrpPn5W47vBliWCuApSKlzUnK/uhIgi4kc72t9AIXr0To6l/1nWj5aezSTr5gel0Tmu7bdgaaNXRMApDPRhZD9Qtf4XquUPwCQ87iEvBgDbMOhi0Phu6tfMIYajDNkdFD6mAVWZf38+HlVKo= 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 172798186339716.722420049250672; Thu, 3 Oct 2024 11:57:43 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.809821.1222386 (Exim 4.92) (envelope-from ) id 1swR0i-000090-UK; Thu, 03 Oct 2024 18:57:12 +0000 Received: by outflank-mailman (output) from mailman id 809821.1222386; Thu, 03 Oct 2024 18:57:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1swR0i-00008t-QE; Thu, 03 Oct 2024 18:57:12 +0000 Received: by outflank-mailman (input) for mailman id 809821; Thu, 03 Oct 2024 18:57:11 +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 1swR0h-0007Yu-PK for xen-devel@lists.xenproject.org; Thu, 03 Oct 2024 18:57:11 +0000 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [2a00:1450:4864:20::22d]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 4bcda88b-81b9-11ef-a0ba-8be0dac302b0; Thu, 03 Oct 2024 20:57:11 +0200 (CEST) Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2fadc95ccfcso16034911fa.1 for ; Thu, 03 Oct 2024 11:57:11 -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) 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: 4bcda88b-81b9-11ef-a0ba-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727981831; x=1728586631; 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=Mm+KI23c86LD33sZYRxxXCIhV12T/Ywht8Xuz1hXe+0=; b=EB8sWwDnh7OQVXn3Vbd/eRnhHD+nf/oKSPdzegTp0RQ5OL1oAUP19xhDaogdBsu07v T/zwhwtzhT5qmLZFMgs/SuwbozAlJCVBlpGJj+thO9z2nPTVYoGCl6oAM5GSaVKf7/x7 riDNxiEESX1NuRiexVw1yhVxDxwmaFX0iivbUquySYYmPsVbnwH5WGP12MDDOhNHjelt lYOxI6hj8JDk7XEliT5rjOgEEALuPTQKX61/jSh8+LKgqwi8yPy43NWy1BtG247MO/gs q81ygufcO3oqz25qpiRSqOuxeqhBitGx/Sr0c6k6LYdnfMzIdfs2yIBQ8ADOYy7HD6Bp PCZg== 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=StbtiBtIyeYKaA0nSY9Md4xO1GkB4WQ6wosfjBC14xHKW0hqgcdug30D4MDVnTR6Rc x60sCcINMzifluH+gBENSADvzDRRzRQ0jPEgcWTs+xMx0kQi6kUMVMINTBt/mB9AFMab eZx2Q71awgUokizXqoXqixnAFThCbCciZjdgxgcehjVDqCnTHbA8tHeyr+wYN5H3e6ei iuKlcxhGJvYAeqfxLZObpKUwMPXBHdRTaQzAiMWCWK+f7ISC8A/VV8r26vjYHTW/lbpj USKkq0XUhma1b0kg2nEmHtGMGQMcCJQD7sRnznrPEmPdE7eTHf4OdOb9nRfUOFPZU7Q5 tVvg== X-Forwarded-Encrypted: i=1; AJvYcCXYDZjxZ926JtiBUaOls2NvtHQ2ZP+PozuWcyJljAoq3Vnfi7wTtTL1BNIZQ1pRDBT0jILA6aO0qMI=@lists.xenproject.org X-Gm-Message-State: AOJu0YwWSgrniwOQvOuW9wCnSQ0lJ+p8aDTfBGwu/RhQeRDvrA3q8kP9 rfqS/+M2i4powTtpOOsx3NkKQuaY72zjQANBDUB7xGlMW46Tl99rjsqezWD+ 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) 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 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1727981865045116600 Content-Type: text/plain; charset="utf-8" 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 0x100000= 00"); 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); } =20 @@ -273,6 +278,30 @@ XEN_PVH_PROP_MEMMAP(pci_ecam) XEN_PVH_PROP_MEMMAP(pci_mmio) XEN_PVH_PROP_MEMMAP(pci_mmio_high) =20 +static void xen_pvh_set_pci_intx_irq_base(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + XenPVHMachineState *xp =3D XEN_PVH_MACHINE(obj); + uint32_t value; + + if (!visit_type_uint32(v, name, &value, errp)) { + return; + } + + xp->cfg.pci_intx_irq_base =3D value; +} + +static void xen_pvh_get_pci_intx_irq_base(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + XenPVHMachineState *xp =3D XEN_PVH_MACHINE(obj); + uint32_t value =3D xp->cfg.pci_intx_irq_base; + + visit_type_uint32(v, name, &value, errp); +} + void xen_pvh_class_setup_common_props(XenPVHMachineClass *xpc) { ObjectClass *oc =3D 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."); } =20 #ifdef CONFIG_TPM --=20 2.43.0 From nobody Thu Nov 21 21:57:17 2024 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=1727981861; cv=none; d=zohomail.com; s=zohoarc; b=IrCnwB7bW1kK+7w1e/4Gy98T4cjoWzLWHCpBNATDCl2/EGYKyAHmVYAA7AzTNwI3KP09bByTfLA8GB+CilqBxqDEFw+mPHcLatUApB85Lwi3KXkMOKxYAYqbs8S+RARWJFX5j0+iyGsSnHaZYiM8nCWGQkkYWBWqU6oSqQCSEcs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727981861; 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=7NqZgDSIdmym8k9v4wrElx9POiJdcsjS85l4BMSFw2Y=; b=Vx6RpRaeoR2ZaWdd0+W6G9QfeEn8IJVXjpQm15GRzB2l9MzHJ/0hDiRsFFQL7SyWFXM8TIhaE3gpdpKTXlGJ+guKSj/BGQ2dcT0CHaMqYlNATa6Akprgh9X/99NWwSnZd9xBStWuaIcI14TXbn3uQbm50u1JqGqVdLli3p3qPmc= 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 1727981861101226.1030117211086; Thu, 3 Oct 2024 11:57:41 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.809822.1222396 (Exim 4.92) (envelope-from ) id 1swR0m-0000X7-6f; Thu, 03 Oct 2024 18:57:16 +0000 Received: by outflank-mailman (output) from mailman id 809822.1222396; Thu, 03 Oct 2024 18:57:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1swR0m-0000Wb-2c; Thu, 03 Oct 2024 18:57:16 +0000 Received: by outflank-mailman (input) for mailman id 809822; Thu, 03 Oct 2024 18:57:14 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1swR0k-00082k-As for xen-devel@lists.xenproject.org; Thu, 03 Oct 2024 18:57:14 +0000 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [2a00:1450:4864:20::22e]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 4caddc82-81b9-11ef-99a2-01e77a169b0f; Thu, 03 Oct 2024 20:57:12 +0200 (CEST) Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2fac63abf63so15451941fa.1 for ; 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) 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: 4caddc82-81b9-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727981832; x=1728586632; 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=7NqZgDSIdmym8k9v4wrElx9POiJdcsjS85l4BMSFw2Y=; b=IFY7a/FyJzyfhvjgBBfsOp7pEBH5rtEGckImg9AlxNXtFefHzVpaop6sMdoudzwdCr orq8hPfEvEBJ+QY6acH7bTCjo+LZo4N5Uc5zKv8l19gmy7Tc8x0smLo3c74J3Fp2JhWc etpgNdAEOuK2WiSrbY/g4qjAiVN0lRuLKyUz68S2VeC2j0Dkm3B82bRk5x74tr+kk2JF cAi/QCCIz/bUrhlvBIcEtJ4q7pTuPasw7VrgxlXPqKOYMw8kNNl0Ka9jQrRmy56dKUx4 EwRTNk3CSnGzS0iB800Dc+lS2qUnMNAjvEv81PABPIuy+w428vdzCXkx744lEPGcCFCa O+3g== 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=JY/e9MeX4AHi5K7qlDRquLyZmtIaPATuvZ3ND/FK7FgpG4KyLMrFwJRX9chQOxwORR P/XtQaFKY5Z6q0ouezVpXyfPlrF34NfE6eRcLVWJcxVfe0aCqRCIysmIsv01iYab3De0 /cdWXNNdKL3DlT+aQBu/eIo+9C2hCpXsm+JRfjmZj/2Bgw6wzRwDd/guLzglUJvoBGci ZA8odQ6ywG7c7Rg/RTkAbwOV/aMluzg4KarWbgEfOyQizW+M3bhvOHIiHeQJgV7k2PXM WgSiOfOx1y0ot2zWFagtcI+A7RAFi1Vo9nfx2HGghD8ZKeBtV6FMolvnD8nBAC5sIzA0 ywQw== X-Forwarded-Encrypted: i=1; AJvYcCVfL0v6Y6Op8yMAhIwnye27fLalZ6jLb055ji7sslPbX+oQrDP1mZyESJxLZafDt3oz8q2TLXUdRhg=@lists.xenproject.org X-Gm-Message-State: AOJu0YwFjinsyRgngQFIpvQTmNzPw3FZUczwIAWAQajGOe20sG5YgQsa Qaad8BtYaupaLf8PX8+D4b8Q3mp/ynrDL1roaSdauPOVPiTSnZyP 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) 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 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1727981863024116600 Content-Type: text/plain; charset="utf-8" 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 }; } =20 +static void xen_pvh_set_pci_intx_irq(void *opaque, int intx_irq, int level) +{ + XenPVHMachineState *s =3D XEN_PVH_MACHINE(opaque); + int irq =3D 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 =3D 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 =3D HVM_IOREQSRV_BUFIOREQ_OFF; =20 + /* PCI INTX delivery. */ + xpc->set_pci_intx_irq =3D xen_pvh_set_pci_intx_irq; + /* List of supported features known to work on PVH ARM. */ + xpc->has_pci =3D true; xpc->has_tpm =3D true; xpc->has_virtio_mmio =3D true; =20 --=20 2.43.0