From patchwork Thu Sep 10 20:22:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Tyshchenko X-Patchwork-Id: 11769119 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4286714F6 for ; Thu, 10 Sep 2020 20:23:49 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0A12E20829 for ; Thu, 10 Sep 2020 20:23:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kUHzfdbe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0A12E20829 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kGT5v-0004Ug-Hp; Thu, 10 Sep 2020 20:22:59 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kGT5t-0004JK-T8 for xen-devel@lists.xenproject.org; Thu, 10 Sep 2020 20:22:57 +0000 X-Inumbo-ID: 63e7381b-d19f-4728-9ca9-4a91c3d046c1 Received: from mail-lj1-x243.google.com (unknown [2a00:1450:4864:20::243]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 63e7381b-d19f-4728-9ca9-4a91c3d046c1; Thu, 10 Sep 2020 20:22:34 +0000 (UTC) Received: by mail-lj1-x243.google.com with SMTP id u4so9846844ljd.10 for ; Thu, 10 Sep 2020 13:22:34 -0700 (PDT) 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=Xd9iPDbckbDh0wvQoJOmY8nE/E6rj2WKAm7YYXahUG8=; b=kUHzfdbeYX+1fNweXVyqWPoIQCYSHnDosSe2bk/LjiIm2cCs8Ik0klq9GF+3f40dit ousNQsT54x+QnUUQliKOHytjh72T8r5X0S5TIjRaPNncQ7YgXXowWSP1JRNvR4eZN6Es Bb5KmjWCLZ69+5T+tL+BjSyaaqiE8sBY2UnX9/nydrHY5JR8LKI1rKh1N0JfewPbxLeD 4WgpMqQumdoihhS4RpCC2P/NvmxtH/ALXqc3/HOQSTeSXP3sGlFkMrUe1WKCPbV/BETt f8ZxKA+l62lX7j5EIJ9ROdBaJqU1Tvfv0tEhfdi9d2zil4IXPubYQhz0MeTTq20NtUMS fYPA== 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=Xd9iPDbckbDh0wvQoJOmY8nE/E6rj2WKAm7YYXahUG8=; b=Q3SvBP32rgkVhSPdZ0X3W0vaKKBN+SXr+/8p1dEw0sNEj3rXcKRYB/eYMn3zmyrKO6 Om6sbza+3j9GosBCoWjGPjFXIvYtOk6931CuMyhz7SjW4rYajoJ5QuilCzOhsPhKPwEu 8s2Dk4seexSL5oZZ1Z9q6tAcyohE1LWgbf0PxI0WLwCluDEuPev4zuS77GKUkGLBME3f ahUlUl9r3GPNf176OJbUx0cpGE2GqeBXPEs3L/TmlFweAheMwYFBBOCHr7qj9qtiNJgE cb7cEXps85UPX4o18Vb4WXbuPxDKYK721ol94wHtrp1XCJdz+e5oczqjGFNwY4Wg4hgS qo8g== X-Gm-Message-State: AOAM533wOZmitqeAoB33EyriA16CX96uFTMRd6Z/bxBlgRYkQVzZP8tT On47pS0nqO79kx1Q4stPtNL1HiFGn+eU1A== X-Google-Smtp-Source: ABdhPJzHfYDsXcMyXftFqHXtCuD4MsFu2fE2g9xUrx/wZ9z3CdaN7IrEpKZ0zson/Yi+fAm+PRbyFw== X-Received: by 2002:a2e:b0d2:: with SMTP id g18mr5569976ljl.198.1599769353414; 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.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Sep 2020 13:22:32 -0700 (PDT) From: Oleksandr Tyshchenko To: xen-devel@lists.xenproject.org Cc: Oleksandr Tyshchenko , Jan Beulich , Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Paul Durrant , Julien Grall , Stefano Stabellini , Julien Grall Subject: [PATCH V1 06/16] xen/ioreq: Make x86's hvm_ioreq_(page/vcpu/server) structs common Date: Thu, 10 Sep 2020 23:22:00 +0300 Message-Id: <1599769330-17656-7-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" From: Oleksandr Tyshchenko The IOREQ is a common feature now and these structs will be used on Arm as is. Move them to 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/include/asm-x86/hvm/domain.h | 34 ---------------------------------- xen/include/xen/ioreq.h | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/xen/include/asm-x86/hvm/domain.h b/xen/include/asm-x86/hvm/domain.h index 9d247ba..765f35c 100644 --- a/xen/include/asm-x86/hvm/domain.h +++ b/xen/include/asm-x86/hvm/domain.h @@ -30,40 +30,6 @@ #include -struct hvm_ioreq_page { - gfn_t gfn; - struct page_info *page; - void *va; -}; - -struct hvm_ioreq_vcpu { - struct list_head list_entry; - struct vcpu *vcpu; - evtchn_port_t ioreq_evtchn; - bool pending; -}; - -#define NR_IO_RANGE_TYPES (XEN_DMOP_IO_RANGE_PCI + 1) -#define MAX_NR_IO_RANGES 256 - -struct hvm_ioreq_server { - struct domain *target, *emulator; - - /* Lock to serialize toolstack modifications */ - spinlock_t lock; - - struct hvm_ioreq_page ioreq; - struct list_head ioreq_vcpu_list; - struct hvm_ioreq_page bufioreq; - - /* Lock to serialize access to buffered ioreq ring */ - spinlock_t bufioreq_lock; - evtchn_port_t bufioreq_evtchn; - struct rangeset *range[NR_IO_RANGE_TYPES]; - bool enabled; - uint8_t bufioreq_handling; -}; - #ifdef CONFIG_MEM_SHARING struct mem_sharing_domain { diff --git a/xen/include/xen/ioreq.h b/xen/include/xen/ioreq.h index 9521170..102f7e8 100644 --- a/xen/include/xen/ioreq.h +++ b/xen/include/xen/ioreq.h @@ -23,6 +23,40 @@ #include +struct hvm_ioreq_page { + gfn_t gfn; + struct page_info *page; + void *va; +}; + +struct hvm_ioreq_vcpu { + struct list_head list_entry; + struct vcpu *vcpu; + evtchn_port_t ioreq_evtchn; + bool pending; +}; + +#define NR_IO_RANGE_TYPES (XEN_DMOP_IO_RANGE_PCI + 1) +#define MAX_NR_IO_RANGES 256 + +struct hvm_ioreq_server { + struct domain *target, *emulator; + + /* Lock to serialize toolstack modifications */ + spinlock_t lock; + + struct hvm_ioreq_page ioreq; + struct list_head ioreq_vcpu_list; + struct hvm_ioreq_page bufioreq; + + /* Lock to serialize access to buffered ioreq ring */ + spinlock_t bufioreq_lock; + evtchn_port_t bufioreq_evtchn; + struct rangeset *range[NR_IO_RANGE_TYPES]; + bool enabled; + uint8_t bufioreq_handling; +}; + #define GET_IOREQ_SERVER(d, id) \ (d)->arch.hvm.ioreq_server.server[id]