From nobody Tue Feb 10 04:17:35 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496151805479982.8611793297443; Tue, 30 May 2017 06:43:25 -0700 (PDT) Received: from localhost ([::1]:53800 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFhQi-0000YK-1H for importer@patchew.org; Tue, 30 May 2017 09:43:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40312) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFhOb-0007Df-54 for qemu-devel@nongnu.org; Tue, 30 May 2017 09:41:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dFhOX-000207-6U for qemu-devel@nongnu.org; Tue, 30 May 2017 09:41:13 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:37636 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dFhOX-0001zo-17 for qemu-devel@nongnu.org; Tue, 30 May 2017 09:41:09 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v4UDct2d169671 for ; Tue, 30 May 2017 09:41:07 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 2as03rphtm-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 30 May 2017 09:41:07 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 30 May 2017 14:41:05 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 30 May 2017 14:41:03 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v4UDf28M38731792; Tue, 30 May 2017 13:41:02 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 34E4711C050; Tue, 30 May 2017 14:39:18 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 229BF11C04A; Tue, 30 May 2017 14:39:18 +0100 (BST) Received: from smtp.lab.toulouse-stg.fr.ibm.com (unknown [9.101.4.1]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 30 May 2017 14:39:18 +0100 (BST) Received: from bahia.lan (icon-9-164-152-88.megacenter.de.ibm.com [9.164.152.88]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id 17C94220194; Tue, 30 May 2017 15:41:02 +0200 (CEST) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 30 May 2017 15:40:30 +0200 X-Mailer: git-send-email 2.7.5 In-Reply-To: <1496151640-29919-1-git-send-email-groug@kaod.org> References: <1496151640-29919-1-git-send-email-groug@kaod.org> X-TM-AS-GCONF: 00 x-cbid: 17053013-0008-0000-0000-0000045888FF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17053013-0009-0000-0000-00001DDB4974 Message-Id: <1496151640-29919-2-git-send-email-groug@kaod.org> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-30_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=15 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705300256 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PULL v2 01/11] virtio-9p/xen-9p: move 9p specific bits to core 9p code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Greg Kurz , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" These bits aren't related to the transport so let's move them to the core code. Signed-off-by: Greg Kurz Reviewed-by: Stefano Stabellini --- hw/9pfs/9p.c | 8 +++++++- hw/9pfs/9p.h | 2 +- hw/9pfs/virtio-9p-device.c | 8 +------- hw/9pfs/xen-9p-backend.c | 6 +----- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index ab3e22f23130..b3048371a8ee 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -3446,12 +3446,16 @@ static inline bool is_read_only_op(V9fsPDU *pdu) } } =20 -void pdu_submit(V9fsPDU *pdu) +void pdu_submit(V9fsPDU *pdu, P9MsgHeader *hdr) { Coroutine *co; CoroutineEntry *handler; V9fsState *s =3D pdu->s; =20 + pdu->size =3D le32_to_cpu(hdr->size_le); + pdu->id =3D hdr->id; + pdu->tag =3D le16_to_cpu(hdr->tag_le); + if (pdu->id >=3D ARRAY_SIZE(pdu_co_handlers) || (pdu_co_handlers[pdu->id] =3D=3D NULL)) { handler =3D v9fs_op_not_supp; @@ -3462,6 +3466,8 @@ void pdu_submit(V9fsPDU *pdu) if (is_ro_export(&s->ctx) && !is_read_only_op(pdu)) { handler =3D v9fs_fs_ro; } + + qemu_co_queue_init(&pdu->complete); co =3D qemu_coroutine_create(handler, pdu); qemu_coroutine_enter(co); } diff --git a/hw/9pfs/9p.h b/hw/9pfs/9p.h index 5312d8a42405..c886ba78d2ee 100644 --- a/hw/9pfs/9p.h +++ b/hw/9pfs/9p.h @@ -347,7 +347,7 @@ ssize_t pdu_marshal(V9fsPDU *pdu, size_t offset, const = char *fmt, ...); ssize_t pdu_unmarshal(V9fsPDU *pdu, size_t offset, const char *fmt, ...); V9fsPDU *pdu_alloc(V9fsState *s); void pdu_free(V9fsPDU *pdu); -void pdu_submit(V9fsPDU *pdu); +void pdu_submit(V9fsPDU *pdu, P9MsgHeader *hdr); void v9fs_reset(V9fsState *s); =20 struct V9fsTransport { diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c index 3782f437029b..245abd8aaef1 100644 --- a/hw/9pfs/virtio-9p-device.c +++ b/hw/9pfs/virtio-9p-device.c @@ -70,13 +70,7 @@ static void handle_9p_output(VirtIODevice *vdev, VirtQue= ue *vq) goto out_free_req; } =20 - pdu->size =3D le32_to_cpu(out.size_le); - - pdu->id =3D out.id; - pdu->tag =3D le16_to_cpu(out.tag_le); - - qemu_co_queue_init(&pdu->complete); - pdu_submit(pdu); + pdu_submit(pdu, &out); } =20 return; diff --git a/hw/9pfs/xen-9p-backend.c b/hw/9pfs/xen-9p-backend.c index 5df97c90fae9..922cc967be63 100644 --- a/hw/9pfs/xen-9p-backend.c +++ b/hw/9pfs/xen-9p-backend.c @@ -243,14 +243,10 @@ static int xen_9pfs_receive(Xen9pfsRing *ring) =20 /* cannot fail, because we only handle one request per ring at a time = */ pdu =3D pdu_alloc(&ring->priv->state); - pdu->size =3D le32_to_cpu(h.size_le); - pdu->id =3D h.id; - pdu->tag =3D le32_to_cpu(h.tag_le); ring->out_size =3D le32_to_cpu(h.size_le); ring->out_cons =3D cons + le32_to_cpu(h.size_le); =20 - qemu_co_queue_init(&pdu->complete); - pdu_submit(pdu); + pdu_submit(pdu, &h); =20 return 0; } --=20 2.7.5