From mboxrd@z Thu Jan 1 00:00:00 1970 From: Suravee Suthikulpanit Subject: Re: [PATCH v8 9/9] perf/amd/iommu: Enable support for multiple IOMMUs Date: Tue, 7 Feb 2017 08:58:33 +0700 Message-ID: <5f33aeb4-7296-db7d-ad86-ea982f266040@amd.com> References: <1484551416-5440-1-git-send-email-Suravee.Suthikulpanit@amd.com> <1484551416-5440-10-git-send-email-Suravee.Suthikulpanit@amd.com> <20170125094653.GO6515@twins.programming.kicks-ass.net> <20170125095538.42n2dnmdkhksuplk@pd.tnic> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20170125095538.42n2dnmdkhksuplk-fF5Pk5pvG8Y@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Borislav Petkov Cc: Peter Zijlstra , iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: iommu@lists.linux-foundation.org Boris, On 1/25/17 16:55, Borislav Petkov wrote: > On Wed, Jan 25, 2017 at 10:46:53AM +0100, Peter Zijlstra wrote: >> Which is absolutely insane. > > Right, > > IMO, the simplest thing to do for your purposes is to embed a struct > amd_iommu pointer into struct perf_amd_iommu at init time so that you > don't have to do all that crazy dance in the PMU functions and iterate > over the iommus in get_amd_iommu() each time. > > Which would then simplify all your other functions. For example: > > int amd_iommu_pc_get_reg(unsigned int idx, u8 bank, u8 cntr, u8 fxn, u64 *value) > > should be > > int amd_iommu_pc_get_reg(struct amd_iommu *iommu, u8 bank, u8 cntr, u8 fxn, u64 *value) > > and you can save yourself a lot of glue code and get rid of that > get_amd_iommu() thing. > That's a good idea. Thanks. I'll do this in V9. Suravee