Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1273086pxb; Thu, 4 Feb 2021 08:52:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJzAjm6yNgz761dUF/j3Groou5pL3+JUhCIMdPd9oJYhYIGVYqM2xGvRMfVQVR/MyGnaKbnr X-Received: by 2002:a17:906:dbd0:: with SMTP id yc16mr10396ejb.524.1612457570104; Thu, 04 Feb 2021 08:52:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612457570; cv=none; d=google.com; s=arc-20160816; b=rYaWpOBvgJR/VVNNFY3vdgVMQnn/kmahZgq4iIZYzfQpkgENqA1yXPy1chJh4mdjRo F6/klvdNop24t1dCnSNkEmR9zqZfsSvM6FCmhsXKf3+zDNfWC7hj2jh/DfF9e+IOZeR0 S7l1Cdm8aTYYllWe5QEuU6oeDCwJQTBzxfsUCAWbiCO42rOEpK/CS0KIxe6MWwGWt0Ux db9h7twtOLqE/EtD2j09A6bt2vAPOxlHQk6c9l/nx7KEH7kJYT69WvY7yEIZPpRfCOgK ev5v63uIHSyXNRqqRNHAn5iOVPOSrrlZZ8kuWtYXoLNHsVPH58eK9EPJALdUkwxJ/VUD IHmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=ZKBnpUeMo730D8AdWVMakbcCm1b7M/eKIDeLqDP9XrI=; b=PERXp01nxtneEeMr6RxfsA545Ej5T4TsQ4VlqNNShyWWBIRKI1Xk36cRrrgZu2IotT wYeHfua7P0RAL5p+ao2c4Gcw3uBTgbT95X4M7eFaddDQPURUo6vWs0sxZTboYhD6LD3N 3htbwAwdqRNSRCc2ZShGogkgGxMNu80Xse/YVOMgkaxpR76+1+EIggeIsvnU5CRsx6/k KwjFZtsdViglzDm1lntidalomBqG8a/ymin6xQJx2v0zR0PZT93nluFT0syp5qBhadaH Q1aknWniTMMx067ukz9IRcCbJLww7MCX61FaJ/tTWuecNnLrF040KoJkRt295vy4PRgO Vxcg== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s10si3599125edd.231.2021.02.04.08.52.24; Thu, 04 Feb 2021 08:52:50 -0800 (PST) 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237165AbhBDQuY (ORCPT + 99 others); Thu, 4 Feb 2021 11:50:24 -0500 Received: from mail-wr1-f49.google.com ([209.85.221.49]:41207 "EHLO mail-wr1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238034AbhBDQtT (ORCPT ); Thu, 4 Feb 2021 11:49:19 -0500 Received: by mail-wr1-f49.google.com with SMTP id p15so4286402wrq.8; Thu, 04 Feb 2021 08:49:03 -0800 (PST) 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:user-agent; bh=ZKBnpUeMo730D8AdWVMakbcCm1b7M/eKIDeLqDP9XrI=; b=kVqMYuBcG83cm3Z6DttbcCuPLQfur60dLncRkL78pnPHwAEerI3bL2J+u0w07L4urZ INLJecDPFRSh6XhFw6Y4zJOG4dsWgTk2Q+sOA/psi6JhbmjXfi2vKfrpAXiVxXQKYsZp 3g1qeZY+2NEuQy2P/zWVSf6aeZhFT1Hfi3i2PJspWZY1aI9+w8QAAx7Wx0yg6PAbvIfy oXNMqAHSmTXBdVxsSiy9pc6NXOun108TtpAQzrJXyn4iaDgSoyHv/v0pnYlOuCrjHcxf bD/5PsGNeEFeDAIek+157/30eJQR77cL9LP4OVd0k6iIqPFKFk6HR0NXAB3UmBiOqdif 0Ksg== X-Gm-Message-State: AOAM531Xi+kkehAc28JmLSjh0Ryfes7Z/3BHPCZj07zCJMNTGRoNSiGP X+junLR/SNDCXqqt2SAxP34= X-Received: by 2002:a5d:5910:: with SMTP id v16mr235527wrd.29.1612457317643; Thu, 04 Feb 2021 08:48:37 -0800 (PST) Received: from liuwe-devbox-debian-v2 ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id v1sm6662200wmj.31.2021.02.04.08.48.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 08:48:37 -0800 (PST) Date: Thu, 4 Feb 2021 16:48:35 +0000 From: Wei Liu To: Michael Kelley Cc: Wei Liu , Linux on Hyper-V List , "virtualization@lists.linux-foundation.org" , Linux Kernel List , Vineeth Pillai , Sunil Muthuswamy , Nuno Das Neves , "pasha.tatashin@soleen.com" , KY Srinivasan , Haiyang Zhang , Stephen Hemminger , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" , Joerg Roedel , Will Deacon , "open list:IOMMU DRIVERS" Subject: Re: [PATCH v5 16/16] iommu/hyperv: setup an IO-APIC IRQ remapping domain for root partition Message-ID: <20210204164835.b74zjs6n5hll5bnz@liuwe-devbox-debian-v2> References: <20210120120058.29138-1-wei.liu@kernel.org> <20210120120058.29138-17-wei.liu@kernel.org> <20210203124700.ugx5vd526455u7lb@liuwe-devbox-debian-v2> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 04, 2021 at 04:41:47PM +0000, Michael Kelley wrote: > From: Wei Liu Sent: Wednesday, February 3, 2021 4:47 AM [...] > > > > + > > > > + if (level) > > > > + intr_desc->trigger_mode = HV_INTERRUPT_TRIGGER_MODE_LEVEL; > > > > + else > > > > + intr_desc->trigger_mode = HV_INTERRUPT_TRIGGER_MODE_EDGE; > > > > + > > > > + __set_bit(vcpu, (unsigned long *)&intr_desc->target.vp_mask); > > > > + > > > > + status = hv_do_rep_hypercall(HVCALL_MAP_DEVICE_INTERRUPT, 0, 0, input, > > output) & > > > > + HV_HYPERCALL_RESULT_MASK; > > > > + local_irq_restore(flags); > > > > + > > > > + *entry = output->interrupt_entry; > > > > + > > > > + return status; > > > > > > As a cross-check, I was comparing this code against hv_map_msi_interrupt(). They are > > > mostly parallel, though some of the assignments are done in a different order. It's a nit, > > > but making them as parallel as possible would be nice. :-) > > > > > > > Indeed. I will see about factoring out a function. > > If factoring out a separate helper function is clumsy, just having the parallel code > in the two functions be as similar as possible makes it easier to see what's the > same and what's different. > No. It is not clumsy at all. I've done it in the newly posted v6. I was baffled why I wrote hv_unmap_interrupt helper to be used by both hv_unmap_ioapic_interrupt and hv_unmap_msi_interrupt in the previous patch, but didn't write a hv_map_interrupt. Maybe I didn't have enough coffee that day. :-/ Thanks for pointing out that issue. It definitely helped improve the quality of this series. Wei.