From nobody Mon Feb 9 11:05:58 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1599769391; cv=none; d=zohomail.com; s=zohoarc; b=gB3C9Kw2VDqVAnssVkjpMBVWM19avjQeDQYvlDOIdvAAg0eDO+kfIZzuxX0Ph+7r/C92Gb6/BuiHVhnsOMVDXndLwvWXJnkQqwbAOEgZNuLGtlpeXgz4f477eHFxh8Fc/16uRrerJHXiw447ibk1n3P/txfyInyVwFCAq5xT+pQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599769391; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=F6QWDalSsEZqTRlINIogmaX7+ZyzDHTCG9cMtOtEtMc=; b=WN9c/NXO2fvDRbWARzE81KAC5OEWdyZ94PC9az9SdI06kRcz2bFIP4NHXa9+PxYitS+3kuSk+90L/+ZUU7yFQEUqNrA0I1QU2nD8dXk8BiGm0aZcB8ygSUrjaFW3iUWKjFpccI6Ewlb2dPFu6OUWApxsBKaDo2d3FXJ9Ezs9grk= 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) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1599769391303304.3800191057203; Thu, 10 Sep 2020 13:23:11 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kGT5q-0004Rv-7H; Thu, 10 Sep 2020 20:22:54 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kGT5o-0004JK-Su for xen-devel@lists.xenproject.org; Thu, 10 Sep 2020 20:22:52 +0000 Received: from mail-lf1-x143.google.com (unknown [2a00:1450:4864:20::143]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1696cf62-9a76-4809-bd20-4d87dfc09198; Thu, 10 Sep 2020 20:22:33 +0000 (UTC) Received: by mail-lf1-x143.google.com with SMTP id m5so4299563lfp.7 for ; Thu, 10 Sep 2020 13:22:33 -0700 (PDT) Received: from otyshchenko.www.tendawifi.com ([212.22.223.21]) by smtp.gmail.com with ESMTPSA id u5sm1584375lfq.17.2020.09.10.13.22.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Sep 2020 13:22:31 -0700 (PDT) X-Inumbo-ID: 1696cf62-9a76-4809-bd20-4d87dfc09198 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=F6QWDalSsEZqTRlINIogmaX7+ZyzDHTCG9cMtOtEtMc=; b=YujSj4+aoQA5vQF48bLihwn9LM7NiDastVOAJGS7Nnl9WtylvKGwSzQM/Jp+Fj4K/P bSWH2HyGu9S4sYiDCuHXiqBPlebuqCyPmGF9GfHhrli7N90yqr2xTGAKVjCc4CTwWPqU leRIgL5WrHgA4B8kI71U442v5crb39G0Rc0069GidZXjymxqIdZYi6yfZGh3si55WVUY cUOPiMqxbfD7MJajWmyZCfN1gHDGbt+MOmD8h68/4Ki4Qp7JZW1dFTiBoh8h1o9SLUsJ 2cUnIPR4CphoJvIvpAomP5IZUD+mZOzwa0nqcddFbljN9hUIeyvlGbJR+t8uSdqfERDL 9X7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=F6QWDalSsEZqTRlINIogmaX7+ZyzDHTCG9cMtOtEtMc=; b=BL0mfiZHJSSlXMqpDqazIQ4TAv5+R3Y3Z5gViwM+HgLZa+4rgvT+l24WcFmIn2VUoH ZATiq9ZcYB0Tj3xeGv9hwBPP+iCGRunwgPV0Ereq02eF2wQswBqeRss4KJ+G4/Yxd/DU uoR1Gj1ityy6QXmjTzYGrbudTBeuOkOCW6gKeEkYRNl0pzi2a365UeKN6uFc0HQ23NTS df5hjTzb+ZVLpSzDEv+AiQG9RNKWQ3Vy/S+QyVOzOw/B+PWlN8uPqkBW02VWT66rJSP3 eZkyQzedo7u9h8PcyDoNjxKVNljLWIWEzACwEa+SomVtBXyvMP8fJtLLhFjocm4+1E+8 nc+Q== X-Gm-Message-State: AOAM530pzW2JBLWapkVVdlEDy5XvGav766gr8GE/xJa+jr6I/DhSLWhl rGVX/Ge34NRQ+/S9TCUzFe04OLnhH22dBQ== X-Google-Smtp-Source: ABdhPJyTbkNlNibKINAgzwYl6JWQ5C6zWZAEhtUThXYGMnPTg0ezEJm/8XmSQKKAjiDeVcglSbCeBQ== X-Received: by 2002:a05:6512:512:: with SMTP id o18mr4994141lfb.98.1599769352032; Thu, 10 Sep 2020 13:22:32 -0700 (PDT) From: Oleksandr Tyshchenko To: xen-devel@lists.xenproject.org Cc: Oleksandr Tyshchenko , Paul Durrant , Jan Beulich , Andrew Cooper , Wei Liu , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Julien Grall , Stefano Stabellini , Julien Grall Subject: [PATCH V1 05/16] xen/ioreq: Make x86's hvm_mmio_first(last)_byte() common Date: Thu, 10 Sep 2020 23:21:59 +0300 Message-Id: <1599769330-17656-6-git-send-email-olekstysh@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1599769330-17656-1-git-send-email-olekstysh@gmail.com> References: <1599769330-17656-1-git-send-email-olekstysh@gmail.com> X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Oleksandr Tyshchenko The IOREQ is a common feature now and these helpers will be used on Arm as is. Move them to include/xen/ioreq.h Signed-off-by: Julien Grall Signed-off-by: Oleksandr Tyshchenko --- Please note, this is a split/cleanup/hardening of Julien's PoC: "Add support for Guest IO forwarding to a device emulator" Changes RFC -> V1: - new patch --- --- xen/arch/x86/hvm/intercept.c | 1 + xen/include/asm-x86/hvm/io.h | 16 ---------------- xen/include/xen/ioreq.h | 16 ++++++++++++++++ 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/xen/arch/x86/hvm/intercept.c b/xen/arch/x86/hvm/intercept.c index cd4c4c1..891e497 100644 --- a/xen/arch/x86/hvm/intercept.c +++ b/xen/arch/x86/hvm/intercept.c @@ -17,6 +17,7 @@ * this program; If not, see . */ =20 +#include #include #include #include diff --git a/xen/include/asm-x86/hvm/io.h b/xen/include/asm-x86/hvm/io.h index 558426b..fb64294 100644 --- a/xen/include/asm-x86/hvm/io.h +++ b/xen/include/asm-x86/hvm/io.h @@ -40,22 +40,6 @@ struct hvm_mmio_ops { hvm_mmio_write_t write; }; =20 -static inline paddr_t hvm_mmio_first_byte(const ioreq_t *p) -{ - return unlikely(p->df) ? - p->addr - (p->count - 1ul) * p->size : - p->addr; -} - -static inline paddr_t hvm_mmio_last_byte(const ioreq_t *p) -{ - unsigned long size =3D p->size; - - return unlikely(p->df) ? - p->addr + size - 1: - p->addr + (p->count * size) - 1; -} - typedef int (*portio_action_t)( int dir, unsigned int port, unsigned int bytes, uint32_t *val); =20 diff --git a/xen/include/xen/ioreq.h b/xen/include/xen/ioreq.h index 2240a73..9521170 100644 --- a/xen/include/xen/ioreq.h +++ b/xen/include/xen/ioreq.h @@ -35,6 +35,22 @@ static inline struct hvm_ioreq_server *get_ioreq_server(= const struct domain *d, return GET_IOREQ_SERVER(d, id); } =20 +static inline paddr_t hvm_mmio_first_byte(const ioreq_t *p) +{ + return unlikely(p->df) ? + p->addr - (p->count - 1ul) * p->size : + p->addr; +} + +static inline paddr_t hvm_mmio_last_byte(const ioreq_t *p) +{ + unsigned long size =3D p->size; + + return unlikely(p->df) ? + p->addr + size - 1: + p->addr + (p->count * size) - 1; +} + static inline bool hvm_ioreq_needs_completion(const ioreq_t *ioreq) { return ioreq->state =3D=3D STATE_IOREQ_READY && --=20 2.7.4