Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2389097ybk; Sun, 17 May 2020 20:07:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlKBBeuix5A8UrsCzStQQnJOtBZ9KM72O+7i8lO0w015JmnuWd/oU/5Q62I9wPGdfJ7pDB X-Received: by 2002:a05:6402:1adc:: with SMTP id ba28mr4889809edb.14.1589771220507; Sun, 17 May 2020 20:07:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589771220; cv=none; d=google.com; s=arc-20160816; b=dnqqYaXXkrmVUAWyzlH7BT89Ujq1wiwyrNnC4jCU08Ip4WqrorZMknLCeD5Nq6yhaI vdLv5j7zZ5avI6EOaiihq0JE4lt62GGpMArlVGigUzFbVOm5zTaXNEgHB6IT75ZOSf5t uSYuh5R3NmgnVzOFBGPt3lti9T7Hbt4ZNfcp5YYuemdWiKsujkZbZlYkxOalJrWNSkHx BvKBBdpDjs1PGC5dVHS/jpJn99ol047jYzrgJEqVGeeRP88IaGbjbLPVQI+dHKnni5Z+ rJ+wGUMLWYW3MQYev3ce1cPi429DViucMSV6uvGS7+1kCX+l278UE7tUdEvfUt1aPtuZ gA4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:ironport-sdr; bh=YRwLL79PsYhbdgdMcufszSu5NvmmBySIZYsHt2iBa8k=; b=Gf+L4MHXvLiBE9cCwaLj0Kvff2LcMNLuveoZlFrZs9U20j/7FdAf99OsmYOxebX61Y FFWXaY6G5ouv4tfK0s1gU+Rz8oHeIA19Yg5puZFaO6tThLYigaxN3Qc3MrN8ia7or33z 8RVNzBiOqQuLBgoi6GCzheCK6BA/+RxARU2YKUPbcOg/icQAzENzsquO4lVcU0ElI2+Z rBagxXU6DfDZwAW94RVoeYCZsutHHZh6UfKZdHxjR5TDlL/+xcAb0mpKmU1ktht7eM9R rnnnz00p05r7qxVuDFQHYut8zk1sLRbUqvxmOOJRYgRyLsiwYH1NIxAkGlcgjZ7hRRXl LKjg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q19si473445edc.439.2020.05.17.20.06.36; Sun, 17 May 2020 20:07:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727033AbgERDCk (ORCPT + 99 others); Sun, 17 May 2020 23:02:40 -0400 Received: from mga14.intel.com ([192.55.52.115]:21760 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726639AbgERDCk (ORCPT ); Sun, 17 May 2020 23:02:40 -0400 IronPort-SDR: azQmqO2J10SWh3CDZEpUtxNnQChCZqYdKov4OTiyY0QLMpUN2kgrbrLMFBD0TnzZZgrmZUjv/O UZHdkbneOqRg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2020 20:02:39 -0700 IronPort-SDR: v8ZzGhIZ1YZDRT0sKRTjnVYJT+D0/Zt0Y3ti7/50UogXp1khFlTEvLd4WraU4XCMk6j1qwl8GY ljDFSQ/Dp/jg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,405,1583222400"; d="scan'208";a="411106132" Received: from joy-optiplex-7040.sh.intel.com ([10.239.13.16]) by orsmga004.jf.intel.com with ESMTP; 17 May 2020 20:02:36 -0700 From: Yan Zhao To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: alex.williamson@redhat.com, cohuck@redhat.com, zhenyuw@linux.intel.com, zhi.a.wang@intel.com, kevin.tian@intel.com, shaopeng.he@intel.com, yi.l.liu@intel.com, xin.zeng@intel.com, hang.yuan@intel.com, Yan Zhao Subject: [RFC PATCH v4 07/10] vfio/pci: introduce a new irq type VFIO_IRQ_TYPE_REMAP_BAR_REGION Date: Sun, 17 May 2020 22:52:45 -0400 Message-Id: <20200518025245.14425-1-yan.y.zhao@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200518024202.13996-1-yan.y.zhao@intel.com> References: <20200518024202.13996-1-yan.y.zhao@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a virtual irq type. vendor driver triggers this irq when it wants to notify userspace to remap PCI BARs. 1. vendor driver triggers this irq and packs the target bar number in the ctx count. i.e. "1 << bar_number". if a bit is set, the corresponding bar is to be remapped. 2. userspace requery the specified PCI BAR from kernel and if flags of the bar regions are changed, it removes the old subregions and attaches subregions according to the new flags. 3. userspace notifies back to kernel by writing one to the eventfd of this irq. Please check the corresponding qemu implementation from the reply of this patch, and a sample usage in vendor driver in patch [10/10]. Cc: Kevin Tian Signed-off-by: Yan Zhao --- include/uapi/linux/vfio.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h index 2d0d85c7c4d4..55895f75d720 100644 --- a/include/uapi/linux/vfio.h +++ b/include/uapi/linux/vfio.h @@ -704,6 +704,17 @@ struct vfio_irq_info_cap_type { __u32 subtype; /* type specific */ }; +/* Bar Region Query IRQ TYPE */ +#define VFIO_IRQ_TYPE_REMAP_BAR_REGION (1) + +/* sub-types for VFIO_IRQ_TYPE_REMAP_BAR_REGION */ +/* + * This irq notifies userspace to re-query BAR region and remaps the + * subregions. + */ +#define VFIO_IRQ_SUBTYPE_REMAP_BAR_REGION (0) + + /** * VFIO_DEVICE_SET_IRQS - _IOW(VFIO_TYPE, VFIO_BASE + 10, struct vfio_irq_set) * -- 2.17.1