From patchwork Mon Jan 25 19:08:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Oleksandr Tyshchenko X-Patchwork-Id: 12044037 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0540C433DB for ; Mon, 25 Jan 2021 19:09:21 +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 AE52D216FD for ; Mon, 25 Jan 2021 19:09:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AE52D216FD 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 list by lists.xenproject.org with outflank-mailman.74299.133537 (Exim 4.92) (envelope-from ) id 1l47Ee-00008P-EF; Mon, 25 Jan 2021 19:09:12 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 74299.133537; Mon, 25 Jan 2021 19:09:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l47Ee-00008G-Ac; Mon, 25 Jan 2021 19:09:12 +0000 Received: by outflank-mailman (input) for mailman id 74299; Mon, 25 Jan 2021 19:09:10 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l47Ec-0008N7-GC for xen-devel@lists.xenproject.org; Mon, 25 Jan 2021 19:09:10 +0000 Received: from mail-wm1-x32c.google.com (unknown [2a00:1450:4864:20::32c]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id a001e2ed-890d-44c7-a0c3-1544d1748298; Mon, 25 Jan 2021 19:08:56 +0000 (UTC) Received: by mail-wm1-x32c.google.com with SMTP id m187so387134wme.2 for ; Mon, 25 Jan 2021 11:08:56 -0800 (PST) Received: from otyshchenko.www.tendawifi.com ([212.22.223.21]) by smtp.gmail.com with ESMTPSA id k6sm12991031wro.27.2021.01.25.11.08.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jan 2021 11:08:54 -0800 (PST) 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: a001e2ed-890d-44c7-a0c3-1544d1748298 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 :mime-version:content-transfer-encoding; bh=OsLFEZreg7YqeEEhgK+SjAQbSMvohSeO9g6je9KBEsI=; b=T9dfsa7gmJ7W9ij7E90dOw8sQ/oEP/vrOLg+A0tjx3SjZX4SrPb2qHgRYjl0PEz4Kk rk7w2UJWqOUt/sUs8II+69Lyx4U5q/TgT3A9isaOt4HDH8XvXgVZE8LWQYEHT/kjA9Y/ sGc0/fc6a4BPVVORdbe7QgkGTNbU7K69s19JY/LIxU1TC2W4YasNYnJILuy7XcfdFA/t k18laMJGxy+Rfd/iXdogqLPOyge+FU+fWAd6TpRcAsh2ALXeaLhDDLXtVt6OXOEJ62q4 yAxveXM2N0oVD+c/yemTrUIUSJz2dTKdFsgVaur6CH6YVjHfCqzjhtEpwpr5XgO9ZBXF dbJA== 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:mime-version:content-transfer-encoding; bh=OsLFEZreg7YqeEEhgK+SjAQbSMvohSeO9g6je9KBEsI=; b=spEGlAgaZxCOjcV89sijeFe7qmeShWouMkvL9HB64lq9++5RkAdzTO62wLq9CVCD1F vVtXoc1EvdgDvKuUs1pIb4YBDKNtCd6K//Ivx6QIcYQzEv3Y/4PjcQmitLZZv458xjmp VLIHFoLAy5Htb6Jv4vsgmsapt/4p71XT7ElVFq07T1gnn5AaopOUNNm/fj9MrRJLa/4d jAdtj3+6/J49hbMB2p5Q3KKhLCBs7XFBw5s1HTrzFll+L8ZcYK7pWQfJ39kBpU58ZgVj 7EdQTu+21mIocOuuXto/7jPNsND24/6fI6yjOAwelqjvCbZVvtbeMdlkwFdUW+nDrjYV ME9A== X-Gm-Message-State: AOAM531kRpOWOYMGGaVDkotLwOOdtvXRS1NAUzDLWeprhfG1gK4uQSqA x0UgjeqBzATNr2beYUAqECyjIXJ7Q2wdLg== X-Google-Smtp-Source: ABdhPJwicXK5X8XYRb1eHofoVzV3U5TxlFZM1E98xbSQrWkgmoNYx3frsyt+PgqQkKp03Nm5JT78/g== X-Received: by 2002:a7b:c09a:: with SMTP id r26mr1494547wmh.64.1611601735366; Mon, 25 Jan 2021 11:08:55 -0800 (PST) From: Oleksandr Tyshchenko To: xen-devel@lists.xenproject.org Cc: Oleksandr Tyshchenko , Paul Durrant , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Stefano Stabellini , Julien Grall , Julien Grall Subject: [PATCH V5 03/22] x86/ioreq: Provide out-of-line wrapper for the handle_mmio() Date: Mon, 25 Jan 2021 21:08:10 +0200 Message-Id: <1611601709-28361-4-git-send-email-olekstysh@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1611601709-28361-1-git-send-email-olekstysh@gmail.com> References: <1611601709-28361-1-git-send-email-olekstysh@gmail.com> MIME-Version: 1.0 From: Oleksandr Tyshchenko The IOREQ is about to be common feature and Arm will have its own implementation. But the name of the function is pretty generic and can be confusing on Arm (we already have a try_handle_mmio()). In order not to rename the function (which is used for a varying set of purposes on x86) globally and get non-confusing variant on Arm provide a wrapper arch_ioreq_complete_mmio() to be used on common and Arm code. Signed-off-by: Oleksandr Tyshchenko Reviewed-by: Jan Beulich Reviewed-by: Alex Bennée Reviewed-by: Julien Grall Reviewed-by: Paul Durrant CC: Julien Grall [On Arm only] Tested-by: Wei Chen --- 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 Changes V1 -> V2: - remove "handle" - add Jan's A-b Changes V2 -> V3: - remove Jan's A-b - update patch subject/description - use out-of-line function instead of #define - put earlier in the series to avoid breakage Changes V3 -> V4: - add Jan's R-b - rename ioreq_complete_mmio() to arch_ioreq_complete_mmio() Changes V4 -> V5: - rebase - add Alex's, Julien's and Paul's R-b --- --- xen/arch/x86/hvm/ioreq.c | 7 ++++++- xen/include/xen/ioreq.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c index 27a4a6f..30e8724 100644 --- a/xen/arch/x86/hvm/ioreq.c +++ b/xen/arch/x86/hvm/ioreq.c @@ -36,6 +36,11 @@ #include #include +bool arch_ioreq_complete_mmio(void) +{ + return handle_mmio(); +} + static void set_ioreq_server(struct domain *d, unsigned int id, struct hvm_ioreq_server *s) { @@ -226,7 +231,7 @@ bool handle_hvm_io_completion(struct vcpu *v) break; case HVMIO_mmio_completion: - return handle_mmio(); + return arch_ioreq_complete_mmio(); case HVMIO_pio_completion: return handle_pio(vio->io_req.addr, vio->io_req.size, diff --git a/xen/include/xen/ioreq.h b/xen/include/xen/ioreq.h index d0980c5..b95d3ef 100644 --- a/xen/include/xen/ioreq.h +++ b/xen/include/xen/ioreq.h @@ -24,6 +24,7 @@ #define HANDLE_BUFIOREQ(s) \ ((s)->bufioreq_handling != HVM_IOREQSRV_BUFIOREQ_OFF) +bool arch_ioreq_complete_mmio(void); bool arch_vcpu_ioreq_completion(enum hvm_io_completion io_completion); int arch_ioreq_server_map_pages(struct hvm_ioreq_server *s); void arch_ioreq_server_unmap_pages(struct hvm_ioreq_server *s);