Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp630851imw; Fri, 8 Jul 2022 08:57:33 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vNojmJrpdqCy3a5SEOKEdJ5CwwUJkkFlocQ5gXoojjHNEp6JLjOetYqxccO5mKx5D6GNBC X-Received: by 2002:a17:903:248:b0:168:ce2f:cbd2 with SMTP id j8-20020a170903024800b00168ce2fcbd2mr4517541plh.63.1657295853111; Fri, 08 Jul 2022 08:57:33 -0700 (PDT) Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f186-20020a636ac3000000b0041160e3dfc5si41597892pgc.379.2022.07.08.08.57.20; Fri, 08 Jul 2022 08:57:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XaI5uNsG; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238511AbiGHPta (ORCPT + 99 others); Fri, 8 Jul 2022 11:49:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238662AbiGHPtX (ORCPT ); Fri, 8 Jul 2022 11:49:23 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B355E2ED5E; Fri, 8 Jul 2022 08:49:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657295362; x=1688831362; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=liJ1xNP88b/IOn0DSv9mLS4gRkR8b+gjB1IZ32wHQ6Y=; b=XaI5uNsGj1LkfMd8Rd7Akcy33uYnAGhX2WLOKVGGHcaZbmKQ+hMg7qQb jpcon01lMMpfYqOGJSAIy9VHBQunN6Q6yxdQukRw+qSrh1xJmxzSb5umD sBjPhFY777ln62HRC3vHKYr8znpCkbFScB/ocjPhcPG7eFIy7lp+MTXQU +4KiSa5gOv9k1jx+9F+gRmAcZAbF67fl1ZwOcucNWbvy+UamwqkDskyYD EazLahJCOKttxHTAXAEceMhoM3CcHoR8pJGXxCWR2i7E8mbFVzDqeu4GD IBp8cLTnfPfAvBqgLmTu7SyGumh2r/CfSR36YeCbf5bTiejpIibWyA3Yo Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10401"; a="283059517" X-IronPort-AV: E=Sophos;i="5.92,256,1650956400"; d="scan'208";a="283059517" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jul 2022 08:49:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,256,1650956400"; d="scan'208";a="621264708" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by orsmga008.jf.intel.com with ESMTP; 08 Jul 2022 08:49:21 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Fri, 8 Jul 2022 08:49:21 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Fri, 8 Jul 2022 08:49:21 -0700 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.46) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Fri, 8 Jul 2022 08:49:18 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GcR9m8cCuFmD3cyjB99LtM+DXiKLSEyq39rqB8wYcMFMD5E2/J5PAQDDjxp6TR/6JnAiwmCk7Z2yoxMdTRyYCB98XO9R/KgxJcCR0Q7Kgi0mbw2lZoCNRlo0juSdtnwcjedEFUupJ9DzqSb18Wat64uSCFjrkdauOspbAbOs+BkTL20a4CQhV7oRit7ZNMQPrT/PXm5SMOnNXBuRHP+tCtTh+SBRxln+PtfK/nxUJncO5s7XixeRxpdclNvwybayCWdhg/r1A/HZiTpPcmKikNCTmr1/OVFAHyf6MbjmCeVm4SCN42a+OIhMED3T+/IpQMw1QtbOPIBmulWnopXZuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Z7UwbsCSX99z4yMrj5OfH4+lAm3TarrBFUtVH7nxQiQ=; b=TWot0ZBKkA4EMKyWek7jC+D9niX3zBvqqHnjbPXrMZA+4M15j1rnv0n9U2juC6k/UJyrBHB6NsbeG5uqwsgqZZqRv3OJ4HQHnqYaIKa7bHjwXeNX5Y4xu1lHSoyVrGr2VTGqT+etlBH7xu9PxqXa40FMfduwjIWJ6IG1TdoauVfe7k+hLEbVE8bPcj6qwRbc91VXCSKt9xz4mH7tEB+yyyZJVLKMYD3ulMf+vbfkHrDkQMRNzp8PWpbEMtCvZLJmkSoteJRm3vT6o107yYEtVfAlKKYRDTLS2kijzZFayxo58IffJCyww4+Y6PnbycF3xn0qBah6k+OS7ENuUocqug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DM4PR11MB6311.namprd11.prod.outlook.com (2603:10b6:8:a6::21) by PH7PR11MB5913.namprd11.prod.outlook.com (2603:10b6:510:137::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.20; Fri, 8 Jul 2022 15:49:17 +0000 Received: from DM4PR11MB6311.namprd11.prod.outlook.com ([fe80::f188:57e2:349e:51da]) by DM4PR11MB6311.namprd11.prod.outlook.com ([fe80::f188:57e2:349e:51da%9]) with mapi id 15.20.5417.020; Fri, 8 Jul 2022 15:49:17 +0000 Date: Fri, 8 Jul 2022 08:49:09 -0700 From: Ira Weiny To: Matthew Wilcox CC: Bjorn Helgaas , Dan Williams , Greg Kroah-Hartman , "Rafael J. Wysocki" , Alison Schofield , Vishal Verma , , , , Subject: Re: [RFC PATCH 2/3] pci/doe: Use devm_xa_init() Message-ID: References: <20220705232159.2218958-3-ira.weiny@intel.com> <20220707160646.GA306751@bhelgaas> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: BYAPR01CA0061.prod.exchangelabs.com (2603:10b6:a03:94::38) To DM4PR11MB6311.namprd11.prod.outlook.com (2603:10b6:8:a6::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 44c751a6-8eba-414e-10bc-08da60f96a1c X-MS-TrafficTypeDiagnostic: PH7PR11MB5913:EE_ X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: w2BtqjVKj0tqzf81sIKqg7sVSIe4zgt6G8ZOwWOu+afmThqxvQ9/qCtkm5d6zDVeKlwgdPsyTk25bH5AAULe3YYvqLNS6pLfxMPoc+Z3hecsK2Dp903189HyBJe7cvgrJgP9zmqFPBhAFUwEN3+l6fO59mpFc2yX/az3+KRwWpy2MYgBSY3iqWqiLSyRpcmEvVtjH8GlJD7QiNj5TcfPeIMEqed7Qf8dVS/N28aIOoyp/ytfALNb3CwlIxVBdR+PQzf3yLVo2FKXeDGNThIoucNNUYEsnuoGtdAgl8zePEqwfZWfuU+IayZCXycHUU4am0wjPf8OtXuqIPgGchT0bAx0WM6ZL6gFjPnEAA/906fOdsOSTBYVyBvJ9f3BQB2zit1mZ/uRlBpKhIUD8OeuAcEGngEt1G/mJndCLFShoFlY27xfyNrzpB3tq4jZXMjhsHVElEoP2WX/cm8DNRPbta8agiQ7qqcT7QjQ6KoYQ+j4vxXSXEy3HWJsS2kt292/6MvpIGMsaUSvmUKfnbHFT+ffdMF5dMBEb/V9ktNpcXQZxwtdTwQPBwHi4lGIdM0odj0g9YLTQbj5zJl801oiPtX2Oai4MqaJPTvPRsHUZgkEodWQEQnCt2CZ88wCWs3QffUiUMPd6RO+LFJ46qfHds/sNyfG43jrKPSd6WS0S77QBv9+8BXF3EbNb2gD9lsVO0+KLSTdy/cAA08STIvVmQ7abw9kX4sBqa3XIoHGqNM2vfeU4Gaz74te5ZdvFYOvIDS8CfBQIFf1qbm3C+wQifK056YtZl7xVIjM9qcuW5kfqKl1EH65+lDmBFrAi9HV X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB6311.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(7916004)(366004)(39860400002)(396003)(136003)(376002)(346002)(2906002)(38100700002)(82960400001)(186003)(5660300002)(33716001)(8936002)(44832011)(6486002)(8676002)(66946007)(66556008)(83380400001)(4326008)(66476007)(86362001)(54906003)(6916009)(9686003)(6512007)(6666004)(478600001)(316002)(41300700001)(6506007)(67856001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?cNTFAOfIelz6fWe8vUH+6lpX/yyA/e1jZjhK+QLpfd43Ig+/DOVKHQUWz3xb?= =?us-ascii?Q?EUnxjqziYWch+TfZ9ogmB3chn4bbc95sz3wmwL+69TOcVMEHMyGOxrIFT8jb?= =?us-ascii?Q?3iNnVe6uE3TP/JuFYTpE8gXPWgmBsSsuzyXS4rOFiTl+yrC6nWcaLM+/X3eB?= =?us-ascii?Q?vN/3yd3CmmKZ4Iz8Xq9tMgfDQXxBQbdfwRAqRYIJ929/ztlAUILzrPtyEOwk?= =?us-ascii?Q?DE5N8o0hSaSD6FJkEV0pxZPN0x5SMUzOZCmB/YL2I+TXol9Ri599QFr6xzyG?= =?us-ascii?Q?FLdWzQ6dZn064f5ugRAo1Q9mZKRum3OPJcPMomXJRxPkIkcCFyikdMrAW5PQ?= =?us-ascii?Q?cp1pFxPpKDcvbt3qgnWHTMMVJFtl+LfEcdZqJpOEIMotoZdAYGSR7bL+XDAL?= =?us-ascii?Q?iLCDXjclR0EoewmC8ArypTPgQakHj5HW3PWxk0KQe0zZrUeJ2waUZzbRE6jN?= =?us-ascii?Q?lL640XZigk8wac7FCaA9FZr8xiNWR2L/yfrNWl5r7GQllhPpIAebJ7tO2hwk?= =?us-ascii?Q?e5O5L+SKxY0tCeRAr/Ru8np+LANTQU0ppTjXiEpeatnuFS4CQdVukypoxdQe?= =?us-ascii?Q?ktBkoI0XmyL+hWxKYeqFKv+dCCOm/aMEFX2uFkU6TvRnVoUlLOQ+3COinmch?= =?us-ascii?Q?KxQcVQjmnj25a8kqrWd69DFuejoUs2ikkm4AH00xYaZvxNpqWAegrTdQyy0Y?= =?us-ascii?Q?6Or1kzIMYeglKbaowyIhiHH7W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ii?Q?znYKyvhWMYBWQhEwW1pxiIZ9Avn9+ZKEkh6BsFxTzd7u?= X-MS-Exchange-CrossTenant-Network-Message-Id: 44c751a6-8eba-414e-10bc-08da60f96a1c X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB6311.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2022 15:49:17.1412 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GRtLFNKVre7foilH8EUscAsLJpbqqf6m8+qGqhvod33vAhhmcL12/3eTi2O7IQmXzXJswgEPijN7UI+AjAUckQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB5913 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 08, 2022 at 04:04:05PM +0100, Matthew Wilcox wrote: > On Fri, Jul 08, 2022 at 07:57:10AM -0700, Ira Weiny wrote: > > > > I'll update this to be more clear in a V1 if it goes that far. But to clarify > > > > here; the protocol information is a u16 vendor id and u8 protocol number. So > > > > we are able to store that in the unsigned long value that would normally be a > > > > pointer to something in the XArray. > > > > > > Er. Signed long. > > > > Sorry I misspoke, xa_mk_value() takes an unsigned long. > > It does, *but* ... > > static inline void *xa_mk_value(unsigned long v) > { > WARN_ON((long)v < 0); > return (void *)((v << 1) | 1); > } > > ... you can't pass an integer that has the top bit set to it. > > > Can't I use xa_mk_value() to store data directly in the entry "pointer"? > > Yes, that's the purpose of xa_mk_value(). From what you said, it sounded > like you were just storing the integer directly, which won't work. > > > +static void *pci_doe_xa_prot_entry(u16 vid, u8 prot) > > +{ > > + return xa_mk_value(((unsigned long)vid << 16) | prot); > > +} > > > > Both Dan and I thought this was acceptable in XArray? > > You haven't tested that on 32-bit, have you? Shift vid by 8 instead of > 16, and it'll be fine. Ah ok. > > (Oh, and you don't need to cast vid; the standard C integer promotions > will promote vid to int before shifting, and you won't lose any bits) Will do, thanks! Ira