From patchwork Mon Oct 16 15:19:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Woodhouse X-Patchwork-Id: 13423563 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9248CCDB474 for ; Mon, 16 Oct 2023 15:19:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233880AbjJPPTw (ORCPT ); Mon, 16 Oct 2023 11:19:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233853AbjJPPTq (ORCPT ); Mon, 16 Oct 2023 11:19:46 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2DE283 for ; Mon, 16 Oct 2023 08:19:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=f7F9SDM1bUdOvNZpQs4iJJJk6zsJmxlOCqdnVelp0m8=; b=JI9Cp5t4Jep1lUjFFL+2rPgVxX C+t5NGWYH8UJ/aniIMYUBrCu0fIU9iTJ+vTpef8EEAB7SClGjGZM/EHHHHvzHfaviA3kVmuw1wCTJ N7L+3vVvqu10dZZELOd1F/uW8Zt80B+gQ/ZJhmZDGhB0DYFzJigrRm1rtICjhe0g+3KEYcdPGyHO9 wYtpxo1U140xHjDKeY1hLWRucnyzVL4t3HlKbqhCq7zFNEb1R7eKbY7k1Xudw5PNi5r3ohP/2s063 dGaCe88IwhB57Kh2/CRrEW4ABoisGKH9B0hgP5tyFACRikVrXcHTs55vFS4Nh/i/uiTWMq4zN+miS eO7T8Hpg==; Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1qsPNC-006lqa-6s; Mon, 16 Oct 2023 15:19:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1qsPNB-0005nO-2c; Mon, 16 Oct 2023 16:19:13 +0100 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_Lureau?= , Paolo Bonzini , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Eduardo Habkost , David Woodhouse , Marcelo Tosatti , qemu-block@nongnu.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org Subject: [PATCH 05/12] hw/xen: populate store frontend nodes with XenStore PFN/port Date: Mon, 16 Oct 2023 16:19:02 +0100 Message-Id: <20231016151909.22133-6-dwmw2@infradead.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231016151909.22133-1-dwmw2@infradead.org> References: <20231016151909.22133-1-dwmw2@infradead.org> MIME-Version: 1.0 Sender: David Woodhouse X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: David Woodhouse This is kind of redundant since without being able to get these through ome other method (HVMOP_get_param) the guest wouldn't be able to access XenStore in order to find them. But Xen populates them, and it does allow guests to *rebind* to the event channel port after a reset. Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- hw/i386/kvm/xen_xenstore.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/i386/kvm/xen_xenstore.c b/hw/i386/kvm/xen_xenstore.c index d2b311109b..3300e0614a 100644 --- a/hw/i386/kvm/xen_xenstore.c +++ b/hw/i386/kvm/xen_xenstore.c @@ -1432,6 +1432,7 @@ static void alloc_guest_port(XenXenstoreState *s) int xen_xenstore_reset(void) { XenXenstoreState *s = xen_xenstore_singleton; + GList *perms; int err; if (!s) { @@ -1459,6 +1460,15 @@ int xen_xenstore_reset(void) } s->be_port = err; + /* Create frontend store nodes */ + perms = g_list_append(NULL, xs_perm_as_string(XS_PERM_NONE, DOMID_QEMU)); + perms = g_list_append(perms, xs_perm_as_string(XS_PERM_READ, xen_domid)); + + relpath_printf(s, perms, "store/ring-ref", "%lu", XEN_SPECIAL_PFN(XENSTORE)); + relpath_printf(s, perms, "store/port", "%u", s->be_port); + + g_list_free_full(perms, g_free); + /* * We don't actually access the guest's page through the grant, because * this isn't real Xen, and we can just use the page we gave it in the