From nobody Tue Mar 3 05:10:35 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1771408359; cv=none; d=zohomail.com; s=zohoarc; b=VnEXrH/d2t+hmp3sOxfWP5KrNWRGnC+YkiINAbTdZRyv+zQY2V5z10C6r6HRin0kdrIr8cfes+x+RkSL8LtTiRSv9KSwuGuyikuTtnq8+VzLpId6ErkAsqdFvJRQW+DACNetfUA38XWdiXyOKvqWua8DABHbWqmUof+ybGFuzkg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771408359; 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=6an1q48KjRbAhbQVvdoHYoaIrt1Vz4lUP6AS4HcAAwE=; b=jBzLa+3TkWi31A0Uzb9YTKcrMitraT1vcT5M8cLJxK8cp3S84/4uqy8c8JACPra1ZfyJ2uTGSNBMBEqAbcO9GC7pUGlNypASHB7bKoIJYHXO/X8Qqt3SFyh+aSaLwCyU4Wh5QgF2Ev/SRTdiYrlIFmWIJWETCP9edXKxi6J0Yoo= 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=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1771408359715256.3224737676685; Wed, 18 Feb 2026 01:52:39 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1235389.1538375 (Exim 4.92) (envelope-from ) id 1vseED-0006o2-HX; Wed, 18 Feb 2026 09:52:17 +0000 Received: by outflank-mailman (output) from mailman id 1235389.1538375; Wed, 18 Feb 2026 09:52:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vseED-0006nv-Dp; Wed, 18 Feb 2026 09:52:17 +0000 Received: by outflank-mailman (input) for mailman id 1235389; Wed, 18 Feb 2026 09:52:16 +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 1vseEC-0006na-6V for xen-devel@lists.xenproject.org; Wed, 18 Feb 2026 09:52:16 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 80498518-0caf-11f1-9ccf-f158ae23cfc8; Wed, 18 Feb 2026 10:52:13 +0100 (CET) Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 496CB3E6CC; Wed, 18 Feb 2026 09:52:13 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D48623EA65; Wed, 18 Feb 2026 09:52:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 25S1MsyLlWnqfQAAD6G6ig (envelope-from ); Wed, 18 Feb 2026 09:52:12 +0000 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: 80498518-0caf-11f1-9ccf-f158ae23cfc8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1771408333; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6an1q48KjRbAhbQVvdoHYoaIrt1Vz4lUP6AS4HcAAwE=; b=HwDxVjLb5rzDl98jUuVjANDuW0gyL4FJdreRStmSyureZa5ALvayYjScEEWK1ueAgSPLG2 jNYC5qBwn0mUXSImvJfemPNtD2iXHRxpT8NsXkaDIiLAFbWL3Rn2lg2KJqS46DqXsoWwhM uJJkkR0Y5EEtyMsOifaOGmOjBTifh40= Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1771408333; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6an1q48KjRbAhbQVvdoHYoaIrt1Vz4lUP6AS4HcAAwE=; b=HwDxVjLb5rzDl98jUuVjANDuW0gyL4FJdreRStmSyureZa5ALvayYjScEEWK1ueAgSPLG2 jNYC5qBwn0mUXSImvJfemPNtD2iXHRxpT8NsXkaDIiLAFbWL3Rn2lg2KJqS46DqXsoWwhM uJJkkR0Y5EEtyMsOifaOGmOjBTifh40= From: Juergen Gross To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-pci@vger.kernel.org, linux-scsi@vger.kernel.org Cc: Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Bjorn Helgaas , "James E.J. Bottomley" , "Martin K. Petersen" , xen-devel@lists.xenproject.org, =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Subject: [PATCH v2 1/2] xenbus: add xenbus_device parameter to xenbus_read_driver_state() Date: Wed, 18 Feb 2026 10:52:04 +0100 Message-ID: <20260218095205.453657-2-jgross@suse.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260218095205.453657-1-jgross@suse.com> References: <20260218095205.453657-1-jgross@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -5.80 X-Spam-Level: X-Spamd-Result: default: False [-5.80 / 50.00]; REPLY(-4.00)[]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCPT_COUNT_TWELVE(0.00)[17]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FROM_HAS_DN(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; TO_DN_SOME(0.00)[]; TAGGED_RCPT(0.00)[netdev]; R_RATELIMIT(0.00)[to_ip_from(RLsote1drt81dzioaq3931x19g)]; RCVD_VIA_SMTP_AUTH(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo] X-Spam-Flag: NO X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1771408360845158500 In order to prepare checking the xenbus device status in xenbus_read_driver_state(), add the pointer to struct xenbus_device as a parameter. Signed-off-by: Juergen Gross Tested-by: Marek Marczykowski-G=C3=B3recki Signed-off-by: Juergen Gross Acked-by: Bjorn Helgaas # drivers/pci/xen-pcifront.c Acked-by: Jakub Kicinski Acked-by: Martin K. Petersen # SCSI --- V2: - add dev parameter description (kernel test robot) --- drivers/net/xen-netfront.c | 34 +++++++++++----------- drivers/pci/xen-pcifront.c | 8 ++--- drivers/scsi/xen-scsifront.c | 2 +- drivers/xen/xen-pciback/xenbus.c | 10 +++---- drivers/xen/xenbus/xenbus_client.c | 4 ++- drivers/xen/xenbus/xenbus_probe.c | 6 ++-- drivers/xen/xenbus/xenbus_probe_frontend.c | 2 +- include/xen/xenbus.h | 3 +- 8 files changed, 36 insertions(+), 33 deletions(-) diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 0969d5c9f6b7..2c414b77dd0f 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -1646,7 +1646,7 @@ static int xennet_xdp_set(struct net_device *dev, str= uct bpf_prog *prog, =20 /* avoid the race with XDP headroom adjustment */ wait_event(module_wq, - xenbus_read_driver_state(np->xbdev->otherend) =3D=3D + xenbus_read_driver_state(np->xbdev, np->xbdev->otherend) =3D=3D XenbusStateReconfigured); np->netfront_xdp_enabled =3D true; =20 @@ -1764,9 +1764,9 @@ static struct net_device *xennet_create_dev(struct xe= nbus_device *dev) do { xenbus_switch_state(dev, XenbusStateInitialising); err =3D wait_event_timeout(module_wq, - xenbus_read_driver_state(dev->otherend) !=3D + xenbus_read_driver_state(dev, dev->otherend) !=3D XenbusStateClosed && - xenbus_read_driver_state(dev->otherend) !=3D + xenbus_read_driver_state(dev, dev->otherend) !=3D XenbusStateUnknown, XENNET_TIMEOUT); } while (!err); =20 @@ -2627,31 +2627,31 @@ static void xennet_bus_close(struct xenbus_device *= dev) { int ret; =20 - if (xenbus_read_driver_state(dev->otherend) =3D=3D XenbusStateClosed) + if (xenbus_read_driver_state(dev, dev->otherend) =3D=3D XenbusStateClosed) return; do { xenbus_switch_state(dev, XenbusStateClosing); ret =3D wait_event_timeout(module_wq, - xenbus_read_driver_state(dev->otherend) =3D=3D - XenbusStateClosing || - xenbus_read_driver_state(dev->otherend) =3D=3D - XenbusStateClosed || - xenbus_read_driver_state(dev->otherend) =3D=3D - XenbusStateUnknown, - XENNET_TIMEOUT); + xenbus_read_driver_state(dev, dev->otherend) =3D=3D + XenbusStateClosing || + xenbus_read_driver_state(dev, dev->otherend) =3D=3D + XenbusStateClosed || + xenbus_read_driver_state(dev, dev->otherend) =3D=3D + XenbusStateUnknown, + XENNET_TIMEOUT); } while (!ret); =20 - if (xenbus_read_driver_state(dev->otherend) =3D=3D XenbusStateClosed) + if (xenbus_read_driver_state(dev, dev->otherend) =3D=3D XenbusStateClosed) return; =20 do { xenbus_switch_state(dev, XenbusStateClosed); ret =3D wait_event_timeout(module_wq, - xenbus_read_driver_state(dev->otherend) =3D=3D - XenbusStateClosed || - xenbus_read_driver_state(dev->otherend) =3D=3D - XenbusStateUnknown, - XENNET_TIMEOUT); + xenbus_read_driver_state(dev, dev->otherend) =3D=3D + XenbusStateClosed || + xenbus_read_driver_state(dev, dev->otherend) =3D=3D + XenbusStateUnknown, + XENNET_TIMEOUT); } while (!ret); } =20 diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c index 11636634ae51..cd22bf984024 100644 --- a/drivers/pci/xen-pcifront.c +++ b/drivers/pci/xen-pcifront.c @@ -856,7 +856,7 @@ static void pcifront_try_connect(struct pcifront_device= *pdev) int err; =20 /* Only connect once */ - if (xenbus_read_driver_state(pdev->xdev->nodename) !=3D + if (xenbus_read_driver_state(pdev->xdev, pdev->xdev->nodename) !=3D XenbusStateInitialised) return; =20 @@ -876,7 +876,7 @@ static int pcifront_try_disconnect(struct pcifront_devi= ce *pdev) enum xenbus_state prev_state; =20 =20 - prev_state =3D xenbus_read_driver_state(pdev->xdev->nodename); + prev_state =3D xenbus_read_driver_state(pdev->xdev, pdev->xdev->nodename); =20 if (prev_state >=3D XenbusStateClosing) goto out; @@ -895,7 +895,7 @@ static int pcifront_try_disconnect(struct pcifront_devi= ce *pdev) =20 static void pcifront_attach_devices(struct pcifront_device *pdev) { - if (xenbus_read_driver_state(pdev->xdev->nodename) =3D=3D + if (xenbus_read_driver_state(pdev->xdev, pdev->xdev->nodename) =3D=3D XenbusStateReconfiguring) pcifront_connect(pdev); } @@ -909,7 +909,7 @@ static int pcifront_detach_devices(struct pcifront_devi= ce *pdev) struct pci_dev *pci_dev; char str[64]; =20 - state =3D xenbus_read_driver_state(pdev->xdev->nodename); + state =3D xenbus_read_driver_state(pdev->xdev, pdev->xdev->nodename); if (state =3D=3D XenbusStateInitialised) { dev_dbg(&pdev->xdev->dev, "Handle skipped connect.\n"); /* We missed Connected and need to initialize. */ diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c index 924025305753..ef74d4da5ab0 100644 --- a/drivers/scsi/xen-scsifront.c +++ b/drivers/scsi/xen-scsifront.c @@ -1175,7 +1175,7 @@ static void scsifront_backend_changed(struct xenbus_d= evice *dev, return; } =20 - if (xenbus_read_driver_state(dev->nodename) =3D=3D + if (xenbus_read_driver_state(dev, dev->nodename) =3D=3D XenbusStateInitialised) scsifront_do_lun_hotplug(info, VSCSIFRONT_OP_ADD_LUN); =20 diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xen= bus.c index b11e401f1b1e..4bd1c7a8957e 100644 --- a/drivers/xen/xen-pciback/xenbus.c +++ b/drivers/xen/xen-pciback/xenbus.c @@ -149,12 +149,12 @@ static int xen_pcibk_attach(struct xen_pcibk_device *= pdev) =20 mutex_lock(&pdev->dev_lock); /* Make sure we only do this setup once */ - if (xenbus_read_driver_state(pdev->xdev->nodename) !=3D + if (xenbus_read_driver_state(pdev->xdev, pdev->xdev->nodename) !=3D XenbusStateInitialised) goto out; =20 /* Wait for frontend to state that it has published the configuration */ - if (xenbus_read_driver_state(pdev->xdev->otherend) !=3D + if (xenbus_read_driver_state(pdev->xdev, pdev->xdev->otherend) !=3D XenbusStateInitialised) goto out; =20 @@ -374,7 +374,7 @@ static int xen_pcibk_reconfigure(struct xen_pcibk_devic= e *pdev, dev_dbg(&pdev->xdev->dev, "Reconfiguring device ...\n"); =20 mutex_lock(&pdev->dev_lock); - if (xenbus_read_driver_state(pdev->xdev->nodename) !=3D state) + if (xenbus_read_driver_state(pdev->xdev, pdev->xdev->nodename) !=3D state) goto out; =20 err =3D xenbus_scanf(XBT_NIL, pdev->xdev->nodename, "num_devs", "%d", @@ -572,7 +572,7 @@ static int xen_pcibk_setup_backend(struct xen_pcibk_dev= ice *pdev) /* It's possible we could get the call to setup twice, so make sure * we're not already connected. */ - if (xenbus_read_driver_state(pdev->xdev->nodename) !=3D + if (xenbus_read_driver_state(pdev->xdev, pdev->xdev->nodename) !=3D XenbusStateInitWait) goto out; =20 @@ -662,7 +662,7 @@ static void xen_pcibk_be_watch(struct xenbus_watch *wat= ch, struct xen_pcibk_device *pdev =3D container_of(watch, struct xen_pcibk_device, be_watch); =20 - switch (xenbus_read_driver_state(pdev->xdev->nodename)) { + switch (xenbus_read_driver_state(pdev->xdev, pdev->xdev->nodename)) { case XenbusStateInitWait: xen_pcibk_setup_backend(pdev); break; diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus= _client.c index 2dc874fb5506..e502435145ae 100644 --- a/drivers/xen/xenbus/xenbus_client.c +++ b/drivers/xen/xenbus/xenbus_client.c @@ -931,12 +931,14 @@ static int xenbus_unmap_ring_hvm(struct xenbus_device= *dev, void *vaddr) =20 /** * xenbus_read_driver_state - read state from a store path + * @dev: xenbus device pointer * @path: path for driver * * Returns: the state of the driver rooted at the given store path, or * XenbusStateUnknown if no state can be read. */ -enum xenbus_state xenbus_read_driver_state(const char *path) +enum xenbus_state xenbus_read_driver_state(const struct xenbus_device *dev, + const char *path) { enum xenbus_state result; int err =3D xenbus_gather(XBT_NIL, path, "state", "%d", &result, NULL); diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_= probe.c index 9f9011cd7447..2eed06ba5d38 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c @@ -191,7 +191,7 @@ void xenbus_otherend_changed(struct xenbus_watch *watch, return; } =20 - state =3D xenbus_read_driver_state(dev->otherend); + state =3D xenbus_read_driver_state(dev, dev->otherend); =20 dev_dbg(&dev->dev, "state is %d, (%s), %s, %s\n", state, xenbus_strstate(state), dev->otherend_watch.node, path); @@ -364,7 +364,7 @@ void xenbus_dev_remove(struct device *_dev) * closed. */ if (!drv->allow_rebind || - xenbus_read_driver_state(dev->nodename) =3D=3D XenbusStateClosing) + xenbus_read_driver_state(dev, dev->nodename) =3D=3D XenbusStateClosin= g) xenbus_switch_state(dev, XenbusStateClosed); } EXPORT_SYMBOL_GPL(xenbus_dev_remove); @@ -514,7 +514,7 @@ int xenbus_probe_node(struct xen_bus_type *bus, size_t stringlen; char *tmpstring; =20 - enum xenbus_state state =3D xenbus_read_driver_state(nodename); + enum xenbus_state state =3D xenbus_read_driver_state(NULL, nodename); =20 if (state !=3D XenbusStateInitialising) { /* Device is not new, so ignore it. This can happen if a diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbu= s/xenbus_probe_frontend.c index f04707d1f667..ca04609730df 100644 --- a/drivers/xen/xenbus/xenbus_probe_frontend.c +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c @@ -253,7 +253,7 @@ static int print_device_status(struct device *dev, void= *data) } else if (xendev->state < XenbusStateConnected) { enum xenbus_state rstate =3D XenbusStateUnknown; if (xendev->otherend) - rstate =3D xenbus_read_driver_state(xendev->otherend); + rstate =3D xenbus_read_driver_state(xendev, xendev->otherend); pr_warn("Timeout connecting to device: %s (local state %d, remote state = %d)\n", xendev->nodename, xendev->state, rstate); } diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h index c94caf852aea..15319da65b7f 100644 --- a/include/xen/xenbus.h +++ b/include/xen/xenbus.h @@ -228,7 +228,8 @@ int xenbus_unmap_ring_vfree(struct xenbus_device *dev, = void *vaddr); int xenbus_alloc_evtchn(struct xenbus_device *dev, evtchn_port_t *port); int xenbus_free_evtchn(struct xenbus_device *dev, evtchn_port_t port); =20 -enum xenbus_state xenbus_read_driver_state(const char *path); +enum xenbus_state xenbus_read_driver_state(const struct xenbus_device *dev, + const char *path); =20 __printf(3, 4) void xenbus_dev_error(struct xenbus_device *dev, int err, const char *fmt,= ...); --=20 2.53.0