From patchwork Mon Jul 24 21:14:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Micha=C5=82_Winiarski?= X-Patchwork-Id: 13325338 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DA58EC0015E for ; Mon, 24 Jul 2023 21:15:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 53BB210E361; Mon, 24 Jul 2023 21:15:35 +0000 (UTC) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3675C10E362; Mon, 24 Jul 2023 21:15:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690233333; x=1721769333; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=ObQZPnTgYJctsRRFRwsoPbyiHauT+kzDucv7KMJN27k=; b=OQBXO8TIp4IU+aiCcxhXMHx8UzUj/ezh+CQjZ1He2CkVOB8KFZKhcKQS MQAJnYKn2C/QGNu2yWysESBVAFnTkCL3xDOwPAtuFUfApt5wxkz+OPI5N EMt2Jly8WAr7j8+oJfHDMr2YsfgQDbR9PbSlLRT+Z4I7jxy4TVIATzgc/ 4roXJdK00jnPWIK2dfpVBPz+NkLQrnrDUWUcVyn1xs40NQqK8xVVNTmLl slr3gj5XEoHGERDQGRbkAOly+OHjLHz2f9dLuTonvyPX2GywXDEbe7IYL sxlBJi7usparvadHC8moQb0Xm3Cd/SlKQqWKKRl0LSaRviG1R/yLV5o1S w==; X-IronPort-AV: E=McAfee;i="6600,9927,10781"; a="365014832" X-IronPort-AV: E=Sophos;i="6.01,228,1684825200"; d="scan'208";a="365014832" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jul 2023 14:15:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10781"; a="899660532" X-IronPort-AV: E=Sophos;i="6.01,228,1684825200"; d="scan'208";a="899660532" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga005.jf.intel.com with ESMTP; 24 Jul 2023 14:15:32 -0700 Received: from orsmsx603.amr.corp.intel.com (10.22.229.16) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 24 Jul 2023 14:15:31 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27 via Frontend Transport; Mon, 24 Jul 2023 14:15:31 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.103) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.27; Mon, 24 Jul 2023 14:15:31 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oA9rcH3JA8NnjP0JNMNfW6OJ0RmtLTLIUN+raHJoKOlfx3K3p97O6E0ucODaAxzePSb8on73FPve7QXPosqT3LFYVZ8yIy9R2u2aht90XRCze0SfJCaO2VcIaCk+5KpfPXIHVQ/c/x78pGBsIjsKYZvZv8sck7s2MnvR+Ufg2y3rrt9mI9qa7ZJidezyfOTIEcjqqMh2eYpis5DiI/A0MTmQC6JN4Da3vQnBjbKMOzpIuv/cHJNqBiZLsxQhz/MCBd62r/RiHeH8A/MD300hLqG8pADO33i4L7PLMBmPGjNAIqpsqBhjsXIyvzJL95HlkUR32vcOPoBNSANLrgbFQA== 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=p0RJm4ACZ5sQ7/Kawds8GvOcxSjjtxeRPVodKaexpq0=; b=DnXr948wRYYCzCCtr7F0WfPev+LjoSUctlpOOlwGwRG04kJ3ukKXpnDq6vfkKEsq0NfNjpfDEoTGOl5Tavo9eJp59dZg7taJerC+oxQH6qqRFTMd/+fIH7IQW6FQ58GY48W8JKusFZ2PPGr0/mGduXOAM71RdrDBFxqO/x8sWfBAWDMrulylew/ZeQvHVodZSp/ypYjGY3l9XYpm8fpbA2JhyIjcGef8hfP6N8iXNsddME2Y14FLwfP+AN3vYG1TJ9CSf8I45jG90F8KDdHzWQmKjLkjedBHKQcxyOCv5fdWLYDR/rdXnwo4gf+hkXBpKoofxK6js85vbI3HMvqkLw== 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 DM4PR11MB5373.namprd11.prod.outlook.com (2603:10b6:5:394::7) by MW5PR11MB5809.namprd11.prod.outlook.com (2603:10b6:303:197::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.32; Mon, 24 Jul 2023 21:15:29 +0000 Received: from DM4PR11MB5373.namprd11.prod.outlook.com ([fe80::1127:c109:d888:f6d1]) by DM4PR11MB5373.namprd11.prod.outlook.com ([fe80::1127:c109:d888:f6d1%5]) with mapi id 15.20.6609.031; Mon, 24 Jul 2023 21:15:29 +0000 From: =?utf-8?q?Micha=C5=82_Winiarski?= To: , , Date: Mon, 24 Jul 2023 23:14:28 +0200 Message-ID: <20230724211428.3831636-5-michal.winiarski@intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230724211428.3831636-1-michal.winiarski@intel.com> References: <20230724211428.3831636-1-michal.winiarski@intel.com> X-ClientProxiedBy: FR2P281CA0132.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9e::6) To DM4PR11MB5373.namprd11.prod.outlook.com (2603:10b6:5:394::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5373:EE_|MW5PR11MB5809:EE_ X-MS-Office365-Filtering-Correlation-Id: f9106c75-42f6-481f-0320-08db8c8b1b64 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 460Li8QNaRhIJlVVYiATDiKjl/mPbHsjsyopBhK+tkMbQm7crmN7p/gxqjuSdyEv3pT9IUJJcsVFjZBdFiMJnHNP9zJMFeECl7zs1Ycve8EVNjYIXgFBpznxHMuHM/gte8gnHRK5e4WGpQBiPKH7pKbvDDK2gnLXPW+bx8cxjreoIgYsIos8iNQ/q+91NhZ0LjYgvWYL3BeqjQJ9vA04qXIcwIzykufacw3R184gC8m3L3FDAK3n+f9gS1XEgP6G9mfQH9aykQPHVJQCr/xddVdFvV1jC3sg/bKo1bguczZ8eQ/vPvbhq/OdFT03uO8pOPwNSCS8J3Y3/Wi/06E0occ+vfLc43U4eeYujs3ZsogidLBt4uKKwWfVP8EF+mrqBss6rDjGFYJ1YsAAsE1NVyM8p7fXsvH54LnIrILubG0nMTLSACGvbheh1eM6S0IvJyhLh2MlIEDCsSdz3+ucnEzFauQ6YvrqsxouEgDDbOAt60VdVQxMqB8YdIDBBZQcpjP8tKShybk2dGja87vCUsfPYKn5Nypaw+FbmhVh131FhuM3CvICP46YX9iTo0ND X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5373.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(136003)(346002)(376002)(39860400002)(396003)(366004)(451199021)(83380400001)(38100700002)(36756003)(82960400001)(86362001)(54906003)(2906002)(186003)(6506007)(1076003)(26005)(6512007)(6486002)(8936002)(5660300002)(8676002)(7416002)(478600001)(316002)(41300700001)(66476007)(66946007)(66556008)(4326008)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?aWP+W84Ty5h+e2Vl3FEsyQ1PT7+e?= =?utf-8?q?i3Iwy5JD/2rs4z808PXG25WoSZnvoRcg4nElCFHMsjN4csyxbzMSrBEO0JIZnI0xI?= =?utf-8?q?JkAWeCIDbV3Vr8FdANP/vd7qFg9OHHZZXuM38dZYB/EEkzAM07T95phAtH9gfMQyH?= =?utf-8?q?GTdEa7eLXRlwBDWjlYx+h7Lcnv13Um2echuWfPGAX2zqTrSg14lX/+u+gVUWR7X7b?= =?utf-8?q?dBMB1aNOvUVhb4ydwj6u3L5STc0B9n6vpSuaupWAll6Xr1IY0kKSLdzGimGGVMUAy?= =?utf-8?q?/wCSmD8HhCZcXFjzAshj7qYxaZUP2Ko+BbM+SPZXwWTerk6Wr3zotRbivo0CoBC2t?= =?utf-8?q?jQwcUxdjpUAW0ymapIMDnbZU51ZzibVj8SlwDQOHFgyUQec+FXBhUFNteLtClS1Cn?= =?utf-8?q?eiAZTyyHmrpBFw8VG7UK4ThUR89EpN4uvwyJyVc0bg6RtN/dG/iBHlLLoSWVz3ai6?= =?utf-8?q?/1E2Y31k4srsI/iv8T16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VdRtoiR9ICbwJEE+qsL4vI01DnXK5NjGiFBSYQEyc4bsEfoXJOu?= =?utf-8?q?qr/d1E5p5fd5KuNxoIC9sJieET9aLJsFLpsIOQqFYbbW/Afu2KZELcXCKkT7j95gE?= =?utf-8?q?Sxv131pN3tHRI2Pf+yd+P7bII0F+pfGmdbhTpzynRpuMRDFv0s0vUKZsEHkKKZs7m?= =?utf-8?q?9a6RO7Ds3w8CSaryZ7Lu2XYDm8Jl7MYafA=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: f9106c75-42f6-481f-0320-08db8c8b1b64 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5373.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2023 21:15:29.2023 (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: UA/g8e58F49tcl/CsOVYBMorCL2mo3kzePvE0frBw5NNXnrGFixDsOn75g5nOzDNbzqkkXTvkQ8lmXJFeV9Um8ugr9LI7I4lGBtF+RYuYv4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR11MB5809 X-OriginatorOrg: intel.com Subject: [Intel-gfx] [PATCH v6 4/4] drm: Introduce force_extended_minors modparam X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pekka Paalanen , Daniel Vetter , David Airlie , Simon Ser , Oded Gabbay , Maxime Ripard , Matthew Wilcox , Thomas Zimmermann , =?utf-8?q?Micha=C5=82_Winiarski?= , James Zhu , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" While there is support for >64 DRM devices on kernel side, existing userspace may still have some hardcoded assumptions and it's possible that it will require changes to be able to use more than 64 devices. Add a modparam to simplify testing and development of >64 devices support on userspace side by allocating minors from the >=192 range (without the need of having >64 physical devices connected). Signed-off-by: MichaƂ Winiarski --- drivers/gpu/drm/drm_drv.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index c2c6e80e6b31..ef6d7b498784 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -57,6 +57,11 @@ MODULE_LICENSE("GPL and additional rights"); DEFINE_XARRAY_ALLOC(drm_minors_xa); +static bool force_extended_minors; +module_param_unsafe(force_extended_minors, bool, 0400); +MODULE_PARM_DESC(force_extended_minors, + "Don't allocate minors in 0-192 range. This can be used for testing userspace support for >64 drm devices (default: false)"); + /* * If the drm core fails to init for whatever reason, * we should prevent any drivers from registering with it. @@ -138,7 +143,7 @@ static void drm_minor_alloc_release(struct drm_device *dev, void *data) static int drm_minor_alloc(struct drm_device *dev, enum drm_minor_type type) { struct drm_minor *minor; - int r; + int r = -EBUSY; minor = drmm_kzalloc(dev, sizeof(*minor), GFP_KERNEL); if (!minor) @@ -147,8 +152,9 @@ static int drm_minor_alloc(struct drm_device *dev, enum drm_minor_type type) minor->type = type; minor->dev = dev; - r = xa_alloc(drm_minor_get_xa(type), &minor->index, - NULL, DRM_MINOR_LIMIT(type), GFP_KERNEL); + if (type == DRM_MINOR_ACCEL || !force_extended_minors) + r = xa_alloc(drm_minor_get_xa(type), &minor->index, + NULL, DRM_MINOR_LIMIT(type), GFP_KERNEL); if (r == -EBUSY && (type == DRM_MINOR_PRIMARY || type == DRM_MINOR_RENDER)) r = xa_alloc(&drm_minors_xa, &minor->index, NULL, DRM_EXTENDED_MINOR_LIMIT, GFP_KERNEL);