From nobody Wed Nov 27 17:44:10 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 ARC-Seal: i=1; a=rsa-sha256; t=1697730093; cv=none; d=zohomail.com; s=zohoarc; b=hMHrzj2nraT2jRy9NdsCoFs863bd9ePAWZVoLaIfrJ3RE6aBxI2OpUIJD7NEAUZZz6GFWWcH20ksRmSlEARhGu5+jRbgrmBJm5fwkM3fkrEwvBbnvlRLL/yG3kCd8VhJa6jA1ol+e1jxPxfuAqLhBpZ8THPOYj3cZuQZdjKtA0w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697730093; h=Content-Type: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=j10esoq0FJNH76opTx2Ikt3KjCQW6JceQg/cwlpclKs=; b=eGChletdAm/UdhuSy3eSGJpaJuCsELYvdJVH3PbdSN+Od1jMqbhlZj4ftMJDLkPfj9LfYgyivmsAdLptBmJyAu2NZCFHAL444Q4nwVbe4RUPZa/EjZpLlfcJ38rhHOpSL01kdCL2Kgi1hZls71b5X5a9aiw7KHxtDGJ/ixi+xos= 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1697730093881754.2634850253369; Thu, 19 Oct 2023 08:41:33 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.619410.964400 (Exim 4.92) (envelope-from ) id 1qtV8k-0006A9-LV; Thu, 19 Oct 2023 15:40:50 +0000 Received: by outflank-mailman (output) from mailman id 619410.964400; Thu, 19 Oct 2023 15:40:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qtV8k-0006A2-Iv; Thu, 19 Oct 2023 15:40:50 +0000 Received: by outflank-mailman (input) for mailman id 619410; Thu, 19 Oct 2023 15:40:49 +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 1qtV8i-0005v1-KU for xen-devel@lists.xenproject.org; Thu, 19 Oct 2023 15:40:49 +0000 Received: from desiato.infradead.org (desiato.infradead.org [2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id de2f3353-6e95-11ee-98d5-6d05b1d4d9a1; Thu, 19 Oct 2023 17:40:46 +0200 (CEST) Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qtV8M-009yCr-2Y; Thu, 19 Oct 2023 15:40:27 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1qtV8M-000PuS-1s; Thu, 19 Oct 2023 16:40:26 +0100 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 X-Inumbo-ID: de2f3353-6e95-11ee-98d5-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description; bh=j10esoq0FJNH76opTx2Ikt3KjCQW6JceQg/cwlpclKs=; b=VayzCs3Jcr5zFnMxp7BlQilagI tXNgRu8R6rL8iIho5a0FncN8I4SUIY7Pm5o0Vjtx0f4nExokqzOz/NEkiNNlht5FyKWMGDt96nV3J Wch5nB2MVR5Xh5Y01vGCYPAtCfRQXpciDPobqK0KJ3+VXXhLxqbrDRbbk1rz50m8yi1+53qLPLdQf LucVSSC+oHKdiyo9XTTwWqvueeBcscIN9lgwQsG7+S1VDTQLhq64Nco/Tu01+1fjHy1g+pj3TeBo1 QHf96QTc6Sxrqe8pi5HQg/QurZqCAqIe538GeKsecG0hNqut8aYw9DSSk3twWpfmXAvKd55LUhbhX JMyavWmA==; From: David Woodhouse To: qemu-devel@nongnu.org Cc: Kevin Wolf , Hanna Reitz , Stefano Stabellini , Anthony Perard , Paul Durrant , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Jason Wang , Marcelo Tosatti , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beraldo Leal , qemu-block@nongnu.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Bernhard Beschow , Joel Upham Subject: [PATCH v2 12/24] hw/xen: add get_frontend_path() method to XenDeviceClass Date: Thu, 19 Oct 2023 16:40:08 +0100 Message-Id: <20231019154020.99080-13-dwmw2@infradead.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231019154020.99080-1-dwmw2@infradead.org> References: <20231019154020.99080-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: David Woodhouse X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html X-ZohoMail-DKIM: pass (identity @infradead.org) X-ZM-MESSAGEID: 1697730095374100001 From: David Woodhouse The primary Xen console is special. The guest's side is set up for it by the toolstack automatically and not by the standard PV init sequence. Accordingly, its *frontend* doesn't appear in =E2=80=A6/device/console/0 ei= ther; instead it appears under =E2=80=A6/console in the guest's XenStore node. To allow the Xen console driver to override the frontend path for the primary console, add a method to the XenDeviceClass which can be used instead of the standard xen_device_get_frontend_path() Signed-off-by: David Woodhouse --- hw/xen/xen-bus.c | 10 +++++++++- include/hw/xen/xen-bus.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c index ece8ec40cd..cc524ed92c 100644 --- a/hw/xen/xen-bus.c +++ b/hw/xen/xen-bus.c @@ -711,8 +711,16 @@ static void xen_device_frontend_create(XenDevice *xend= ev, Error **errp) { ERRP_GUARD(); XenBus *xenbus =3D XEN_BUS(qdev_get_parent_bus(DEVICE(xendev))); + XenDeviceClass *xendev_class =3D XEN_DEVICE_GET_CLASS(xendev); =20 - xendev->frontend_path =3D xen_device_get_frontend_path(xendev); + if (xendev_class->get_frontend_path) { + xendev->frontend_path =3D xendev_class->get_frontend_path(xendev, = errp); + if (!xendev->frontend_path) { + return; + } + } else { + xendev->frontend_path =3D xen_device_get_frontend_path(xendev); + } =20 /* * The frontend area may have already been created by a legacy diff --git a/include/hw/xen/xen-bus.h b/include/hw/xen/xen-bus.h index f435898164..eb440880b5 100644 --- a/include/hw/xen/xen-bus.h +++ b/include/hw/xen/xen-bus.h @@ -33,6 +33,7 @@ struct XenDevice { }; typedef struct XenDevice XenDevice; =20 +typedef char *(*XenDeviceGetFrontendPath)(XenDevice *xendev, Error **errp); typedef char *(*XenDeviceGetName)(XenDevice *xendev, Error **errp); typedef void (*XenDeviceRealize)(XenDevice *xendev, Error **errp); typedef void (*XenDeviceFrontendChanged)(XenDevice *xendev, @@ -46,6 +47,7 @@ struct XenDeviceClass { /*< public >*/ const char *backend; const char *device; + XenDeviceGetFrontendPath get_frontend_path; XenDeviceGetName get_name; XenDeviceRealize realize; XenDeviceFrontendChanged frontend_changed; --=20 2.40.1