Received: by 2002:a19:ad09:0:0:0:0:0 with SMTP id t9csp4610610lfc; Tue, 1 Sep 2020 06:56:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4YfvaVtd8GV9ewREuS2ffNcFg12Lkw8M+f3Qa+NnHvsbI+5ZqAjnXGXpZd5xsSv2fEnSz X-Received: by 2002:a25:46d5:: with SMTP id t204mr3027091yba.434.1598968579495; Tue, 01 Sep 2020 06:56:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598968579; cv=none; d=google.com; s=arc-20160816; b=XhGOT0iZjDpdighCOLg57TsLNmPy3MVfBmmgCkEQ/t0H/KY5MmOaoR6sUbMBZr9IXC ZrwctsOUjXWJp7h8GZiqGihn8dwjTQ09mUQmxLXGoOx8u2APNA30TycFgSBAlo8Eh8zM Yadu6LNQbw4mTWE1FHjeSqp4c61Qg2gL7YGSQIiy+kQL4mo6Co2txg84UQxi/pDndliE BfsdR6O53pM3PUIJE2Z1G1XuTnSrm6Draa2B58UduTwKx4TMVz5s9wR4CrgfC+/8pwNy aB+Xcfphxoo03LE1slhf0bmnz9v2taZcUvbKSAMSpcHE29+iSpqrxfb9unDbBJKC1gDE h6tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=hL4UU6UW/U1i0rBrax0K1b6/ws7EZEF6wAgUhedS6w0=; b=SUv+F3+bqCHVYCJExs4i5UsVg4tgnWx/FjcZFh+pgBCmWqjYVOl2NP/Aw0e/KU8X4o v3x5nZFB6k8C3XaBxj55izhJ6VAhMP2wqL8gT3nJSEgieMpVstlM7vOtolLSqIru0GFn steq27uP/rZpbI/QLcxWzyGS1PCzOPRHuu6eb72pLYr/1X3gGLumAmUByNZxEMVTRVJU Nf88PVZ61aCQHsRO4Gy9ZRlHYM+1KYhsjWMLzTmsGB2f5JzNLLg2T/vvh0XRReP6SX7r yN2oGH7b1hpHBzhuG0VVUs5a/6kdBkkIZ0eWblX7CXHfNdLJyF/sxMQq3TKaYJLMDlR1 61mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=dNjFg86M; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w188si1469039ybc.281.2020.09.01.06.56.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 01 Sep 2020 06:56:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=dNjFg86M; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:39740 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kD6lm-0002GZ-QN for alex.bennee@linaro.org; Tue, 01 Sep 2020 09:56:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50402) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kD6kj-0000fc-AL for qemu-arm@nongnu.org; Tue, 01 Sep 2020 09:55:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:53276) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kD6kg-0001Up-F0 for qemu-arm@nongnu.org; Tue, 01 Sep 2020 09:55:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598968509; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hL4UU6UW/U1i0rBrax0K1b6/ws7EZEF6wAgUhedS6w0=; b=dNjFg86MrZ6fcl275W9p/X5nPd8MmCdJtpIJv1OI05KM1NBboz4gqrP+zDjkwLYXYAPQXF Pa7eby6MKZjPI34fXvP51WhwTNxWi0e2NZ65hoKcQ4/cyuw+YR3o7ANequwmLf7xqUSoQC IIeWOb0hxlpvQ3TF4SburHOnV3CBL9M= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-142-zqXyVy2dON60E0-Oy-J__Q-1; Tue, 01 Sep 2020 09:55:07 -0400 X-MC-Unique: zqXyVy2dON60E0-Oy-J__Q-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D759B18B9F2D; Tue, 1 Sep 2020 13:55:05 +0000 (UTC) Received: from eperezma.remote.csb (ovpn-114-76.ams2.redhat.com [10.36.114.76]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5DC857C549; Tue, 1 Sep 2020 13:54:28 +0000 (UTC) From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org, Peter Xu Subject: [RFC v7 3/5] memory: Add IOMMU_DEVIOTLB_UNMAP IOMMUTLBNotificationType Date: Tue, 1 Sep 2020 15:53:41 +0200 Message-Id: <20200901135343.22136-4-eperezma@redhat.com> In-Reply-To: <20200901135343.22136-1-eperezma@redhat.com> References: <20200901135343.22136-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eperezma@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=63.128.21.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/31 23:17:53 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Aleksandar Rikalo , Yan Zhao , Eduardo Habkost , Juan Quintela , qemu-ppc@nongnu.org, Jason Wang , "Michael S. Tsirkin" , Eric Auger , qemu-arm@nongnu.org, =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Avi Kivity , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , David Gibson Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: HlPalznxZf85 Adapt intel and vhost to use this new notification type Signed-off-by: Eugenio Pérez --- hw/i386/intel_iommu.c | 2 +- hw/virtio/vhost.c | 2 +- include/exec/memory.h | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 0c4aef5cb5..cdddb089e7 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -2468,7 +2468,7 @@ static bool vtd_process_device_iotlb_desc(IntelIOMMUState *s, sz = VTD_PAGE_SIZE; } - event.type = IOMMU_NOTIFIER_UNMAP; + event.type = IOMMU_NOTIFIER_DEVIOTLB; event.entry.target_as = &vtd_dev_as->as; event.entry.addr_mask = sz - 1; event.entry.iova = addr; diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 1a1384e7a6..6ca168b47e 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -729,7 +729,7 @@ static void vhost_iommu_region_add(MemoryListener *listener, iommu_idx = memory_region_iommu_attrs_to_index(iommu_mr, MEMTXATTRS_UNSPECIFIED); iommu_notifier_init(&iommu->n, vhost_iommu_unmap_notify, - IOMMU_NOTIFIER_UNMAP, + IOMMU_NOTIFIER_DEVIOTLB, section->offset_within_region, int128_get64(end), iommu_idx); diff --git a/include/exec/memory.h b/include/exec/memory.h index 8a56707169..215e23973d 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -87,6 +87,8 @@ typedef enum { IOMMU_NOTIFIER_UNMAP = 0x1, /* Notify entry changes (newly created entries) */ IOMMU_NOTIFIER_MAP = 0x2, + /* Notify changes on device IOTLB entries */ + IOMMU_NOTIFIER_DEVIOTLB = 0x04, } IOMMUNotifierFlag; #define IOMMU_NOTIFIER_ALL (IOMMU_NOTIFIER_MAP | IOMMU_NOTIFIER_UNMAP) -- 2.18.1