From patchwork Thu Apr 14 19:19:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Tyshchenko X-Patchwork-Id: 12813945 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A9426C433F5 for ; Thu, 14 Apr 2022 19:21:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NdM0Jdw9l0M+frFULNbinvw7x/T1raic4xd/eSs8z7c=; b=zys/wSMCnFLXxM O4iYsyeZNf0yKXzxpoBmLLMjBkPQxzYvhBMs+wrvP1RTWencKC8bC0wDyh5r9OKZXEg37QpIfI1nC cJuT2gNit2DiTYgsO1JY9JelFEyALm+T5Fwd6BNjPCOlUN2ai8wFfwTeq+pJGrI/U3qGWTDWo4hzc BET6rbhEA4n1d9sw3wovaMK/wKgdFqWMykK24xEbIrDgbsQ6jL2uM/4epeqjw2CH0CtBkQu2FQzBV kbMXNvWdK1DCEy+eo6RdnYeoeEAK5lYhN2qi5FFGOtQqE6KXJFPn2EVwr8ib0YlZE/1cF2vWHmsi+ m54uFSCQAy28LOL8Mz0g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nf50w-0072AW-JS; Thu, 14 Apr 2022 19:20:22 +0000 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nf50N-0071wj-9x for linux-arm-kernel@lists.infradead.org; Thu, 14 Apr 2022 19:19:49 +0000 Received: by mail-lf1-x12f.google.com with SMTP id x17so10742480lfa.10 for ; Thu, 14 Apr 2022 12:19:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JLvcL2fLROn3t3atjcd/ETf/m7mMDU63S8SDHDmllis=; b=PHixjVnS4M4CDbB1CHxDVeo28b/aVzSp0mJdrnkLOhqhj+Q/2wwhqo/TFVejF1D2cn M+V0zaS78dJd9lsRuBeMiEdLy1jV96PMJyIQ6tdjGX+3REplXlVqvCJvz8NPjkgZDOPf 0khIrkBNwrWYo3QJ78y6BdHbLNpK0mHknzDWftCsqrE3xGyfA0HJKlIH7azM+WvVfhCo FHFrJ5hJRJK3Z7+BjHY/QTvixVEHiQzKm5aCRqRcCN/lRd8u9CYEkm4z/L9bHAfjRB0R fxISXS4qdfBlfdENdbDSL4T/6mCEkKAVOD6Rznx/DdO6NACB2S+j7tbT1uhlqWI/zvSd XiZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JLvcL2fLROn3t3atjcd/ETf/m7mMDU63S8SDHDmllis=; b=BZKDzevLokf+STVGXgULS8mbqt1oVaLSxc6o+GeVJujPcQbagg6EpjSSHK5IHUf1mA 3XgQJelgo/pvDVIGBVbRkdzV38YxRbcM9cBvjf+hF+i5S5TlKPs9mN5Y60Q55xmy2Jhi URD8eoS/eLvmK5FhcINrs6jXxX1xk6Yrtej4bjYqSMOxTu7u4fhBGsOQLZc8C0GATTnd qUnyhKuNy9TOdEKbtJwDMhxiJ3PwecGnZSgXBL3h8OGDi0fIrtYcMLtELMdG7CKwBBZJ 2LMRFAoJ2z1HORA4T/buA6YYRaVBe/sgHoki48+yE5lB9iOl61D7zGR9A9S0ulEiJMid HZvw== X-Gm-Message-State: AOAM531wedEZLiITLcuseY7t2UdqPQ3atNQ3e4HPsU7dDu/ndFZaYxbK ymfs4RmWIGbA7QXl+/ROMH0= X-Google-Smtp-Source: ABdhPJwMUxbIWiWwpSwBanMHzTQNTMGbJ4JbV9MkuLqT17euk/S+BBLtlBgciKyx0qEt1KTBdH2vcw== X-Received: by 2002:a05:6512:1082:b0:44a:a6be:90b with SMTP id j2-20020a056512108200b0044aa6be090bmr2827259lfg.45.1649963985288; Thu, 14 Apr 2022 12:19:45 -0700 (PDT) Received: from otyshchenko.router ([212.22.223.21]) by smtp.gmail.com with ESMTPSA id l3-20020a194943000000b0046b928d2795sm85001lfj.67.2022.04.14.12.19.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Apr 2022 12:19:44 -0700 (PDT) From: Oleksandr Tyshchenko To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Oleksandr Tyshchenko , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , Julien Grall Subject: [RFC PATCH 6/6] arm/xen: Assign xen-virtio DMA ops for virtio devices in Xen guests Date: Thu, 14 Apr 2022 22:19:33 +0300 Message-Id: <1649963973-22879-7-git-send-email-olekstysh@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1649963973-22879-1-git-send-email-olekstysh@gmail.com> References: <1649963973-22879-1-git-send-email-olekstysh@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220414_121947_414258_D6B3E3A3 X-CRM114-Status: GOOD ( 12.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Oleksandr Tyshchenko Call xen_virtio_setup_dma_ops() only for Xen-aware virtio devices in Xen guests if restricted access to the guest memory is enabled. Signed-off-by: Oleksandr Tyshchenko --- include/xen/arm/xen-ops.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/xen/arm/xen-ops.h b/include/xen/arm/xen-ops.h index 621da05..28b2ad3 100644 --- a/include/xen/arm/xen-ops.h +++ b/include/xen/arm/xen-ops.h @@ -2,12 +2,19 @@ #ifndef _ASM_ARM_XEN_OPS_H #define _ASM_ARM_XEN_OPS_H +#include #include +#include static inline void xen_setup_dma_ops(struct device *dev) { if (xen_swiotlb_detect()) dev->dma_ops = &xen_swiotlb_dma_ops; + +#ifdef CONFIG_XEN_VIRTIO + if (arch_has_restricted_virtio_memory_access() && xen_is_virtio_device(dev)) + xen_virtio_setup_dma_ops(dev); +#endif } #endif /* _ASM_ARM_XEN_OPS_H */