From nobody Mon Feb 9 08:10:35 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604516481; cv=none; d=zohomail.com; s=zohoarc; b=etwyDh/i1mOi6s+rFINP/hpXz4ql4sVt6bN7tJmEVlYqomMdiJJCtuIyQIVDsTmbdOfheDomX5bFZQA4m7XayK7ors5eOy/Y4uLfFTnPKzwaW9SAhn1lnySNBVapcWiB5yr3nl+yLCuztmwZlAsV74BI73xAfNOaoMl38lWs/Jk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604516481; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FfMG5NPSSgbiHzXp+0EZ66dpqrizcgkZqiSRInNVyXY=; b=ZcSFXSrfHzvJauyjc6PykaNZj8/CoS0qLqBWkxefWwGjyMzDx/WOeOLKVoPr2OwtkSBt5uCsIg5uygcUsoxGNa6tKt+5TEdX2KdgIUL0GxsgbHFphpS4ySL61OL16PxNJGBN9YEoNkY8KxNNQdw1PgKam8p6OMofvvP8tJ0R8R4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604516481673442.63949222257565; Wed, 4 Nov 2020 11:01:21 -0800 (PST) Received: from localhost ([::1]:35786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kaO22-0006nA-NB for importer@patchew.org; Wed, 04 Nov 2020 14:01:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kaNmN-00065Z-B5 for qemu-devel@nongnu.org; Wed, 04 Nov 2020 13:45:07 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:47568) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kaNmL-0002K1-J7 for qemu-devel@nongnu.org; Wed, 04 Nov 2020 13:45:06 -0500 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-581-i9L0S8N4NtiZhT6n4B4ltg-1; Wed, 04 Nov 2020 13:42:12 -0500 Received: by mail-wm1-f69.google.com with SMTP id 8so935725wmg.6 for ; Wed, 04 Nov 2020 10:42:12 -0800 (PST) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id z6sm3305461wmi.1.2020.11.04.10.42.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Nov 2020 10:42:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604515504; 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: in-reply-to:in-reply-to:references:references; bh=FfMG5NPSSgbiHzXp+0EZ66dpqrizcgkZqiSRInNVyXY=; b=XkJULi4OmHaOuImieIm2HL9lLoOm9la89sSC0Zgvw8ixVpAm3Cj0jHMpoZu4Hyw7ohQzge JGZ/7fvmMZ5vhEXkZuIUsGpMLM2fL8zeEc65ykrzjiOuA47IuiMgJ86SCjP7TOEEeIfPkc PcStGF1uj55WxriNXkBuei0OfaVccsQ= X-MC-Unique: i9L0S8N4NtiZhT6n4B4ltg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=FfMG5NPSSgbiHzXp+0EZ66dpqrizcgkZqiSRInNVyXY=; b=Q2GXuUu+kxV8bhbz1IJWK3Yz3tmTOPGWy3GQXs52gmtR0/tt3GWVdiVNWmJSOlAfZ3 86/ato4fUyl7iiq12RVOag4qHab/OaxPh1qFtg26x+3Bve7BQnTUDsGKBXg7QWHPrr+6 L/wj2ifHKw+V/WKCHZ7HH6rBcG6TPRq97OSECT/fWR3uVqWI6X1On6Xj6PQTFdKBqZI5 HvPWzuSm+/SExX3GSTXBmPu81q13B8nI37Gy7YXEHvecgt+zKRFBFxNZEuyab8Fg3+GQ z5/fmfGimj9vkgCNjRXbj6LJDCmjR8jKr7tRtIOqQ17hkehNBltu+VaRMjXU3Ebfo9lZ VeBw== X-Gm-Message-State: AOAM532fWGhN47LFSHy8PRnkuvzvZjFuXIuc6f22VMwzC5eD2GkRb65F UPqS7baaAp4USTDL9Bev3YevqsGYo9pW21qOHbbvLmkmypBSHElhfFPE7f/DibI1fkBhJeO0Dbx PUlkY7P3wJpeXtS8= X-Received: by 2002:adf:de12:: with SMTP id b18mr7511405wrm.187.1604515330973; Wed, 04 Nov 2020 10:42:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJzTNL81NP5kHCGWWFtfx6N9gOC8g0lDMnMbr2Cn5jsQHzQlJBByvpT1NTvJIVx6ZRj3vL9J6A== X-Received: by 2002:adf:de12:: with SMTP id b18mr7511384wrm.187.1604515330773; Wed, 04 Nov 2020 10:42:10 -0800 (PST) Date: Wed, 4 Nov 2020 13:42:08 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v3 18/31] virtio-iommu: Add notify_flag_changed() memory region callback Message-ID: <20201104184040.285057-19-mst@redhat.com> References: <20201104184040.285057-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201104184040.285057-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/03 00:03:41 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@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 , Bharat Bhushan , Jean-Philippe Brucker , Eric Auger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Bharat Bhushan Add notify_flag_changed() to notice when memory listeners are added and removed. Acked-by: Eric Auger Signed-off-by: Bharat Bhushan Signed-off-by: Jean-Philippe Brucker Message-Id: <20201030180510.747225-7-jean-philippe@linaro.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-iommu.c | 14 ++++++++++++++ hw/virtio/trace-events | 2 ++ 2 files changed, 16 insertions(+) diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c index 985257c88f..78e07aa40a 100644 --- a/hw/virtio/virtio-iommu.c +++ b/hw/virtio/virtio-iommu.c @@ -886,6 +886,19 @@ unlock: qemu_mutex_unlock(&s->mutex); } =20 +static int virtio_iommu_notify_flag_changed(IOMMUMemoryRegion *iommu_mr, + IOMMUNotifierFlag old, + IOMMUNotifierFlag new, + Error **errp) +{ + if (old =3D=3D IOMMU_NOTIFIER_NONE) { + trace_virtio_iommu_notify_flag_add(iommu_mr->parent_obj.name); + } else if (new =3D=3D IOMMU_NOTIFIER_NONE) { + trace_virtio_iommu_notify_flag_del(iommu_mr->parent_obj.name); + } + return 0; +} + static void virtio_iommu_device_realize(DeviceState *dev, Error **errp) { VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); @@ -1116,6 +1129,7 @@ static void virtio_iommu_memory_region_class_init(Obj= ectClass *klass, =20 imrc->translate =3D virtio_iommu_translate; imrc->replay =3D virtio_iommu_replay; + imrc->notify_flag_changed =3D virtio_iommu_notify_flag_changed; } =20 static const TypeInfo virtio_iommu_info =3D { diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events index ea3c3b25ad..982d0002a6 100644 --- a/hw/virtio/trace-events +++ b/hw/virtio/trace-events @@ -109,6 +109,8 @@ virtio_iommu_fill_resv_property(uint32_t devid, uint8_t= subtype, uint64_t start, virtio_iommu_notify_map(const char *name, uint64_t virt_start, uint64_t vi= rt_end, uint64_t phys_start, uint32_t flags) "mr=3D%s virt_start=3D0x%"PRIx= 64" virt_end=3D0x%"PRIx64" phys_start=3D0x%"PRIx64" flags=3D%d" virtio_iommu_notify_unmap(const char *name, uint64_t virt_start, uint64_t = virt_end) "mr=3D%s virt_start=3D0x%"PRIx64" virt_end=3D0x%"PRIx64 virtio_iommu_remap(const char *name, uint64_t virt_start, uint64_t virt_en= d, uint64_t phys_start) "mr=3D%s virt_start=3D0x%"PRIx64" virt_end=3D0x%"PR= Ix64" phys_start=3D0x%"PRIx64 +virtio_iommu_notify_flag_add(const char *name) "add notifier to mr %s" +virtio_iommu_notify_flag_del(const char *name) "del notifier from mr %s" =20 # virtio-mem.c virtio_mem_send_response(uint16_t type) "type=3D%" PRIu16 --=20 MST