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 AAAF1C54EE9 for ; Tue, 20 Sep 2022 16:57:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B9DD310E720; Tue, 20 Sep 2022 16:57:52 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 641F710E720; Tue, 20 Sep 2022 16:57:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663693070; x=1695229070; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=DDJtwcRKp8jf0ywLyVpxIicuHNV8x0LfsN1pEW6IGM8=; b=mQQ509CXzdm4lZs1x60rMtUNig/WCsiouQKdfsjoeL301CsdwqX6EaT8 VGqiMS7TN3esfvQ+HswaWTPRC7FU9PzbRTW4WTGJlojPE7SfW7ZrYwCoy k3JNbsZ6yp6X+Sn4LhxHGGwpe9hhpo9FHGUU1ttSRFdhzfh1JFGi+ENVW /dKBeRdp5cPMEkFgjgtQWJ98vw7ahkwsl7ibvume8YGSAGJAesCCGtzpk oXBxcCn3YDwFU3HvBgwElbtGUZEKJZZkWiopsxRy/YMZ7NWcGUCTIMJJo DhF9pn3ACbyD+Qm6Eh4k7FZo3Jx2FLfn5hG/jCv5ewmbG+wXBuXQCb3ub A==; X-IronPort-AV: E=McAfee;i="6500,9779,10476"; a="386042741" X-IronPort-AV: E=Sophos;i="5.93,331,1654585200"; d="scan'208";a="386042741" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2022 09:57:49 -0700 X-IronPort-AV: E=Sophos;i="5.93,331,1654585200"; d="scan'208";a="652170048" Received: from ashyti-mobl2.igk.intel.com (HELO intel.com) ([172.28.173.21]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2022 09:57:48 -0700 Date: Tue, 20 Sep 2022 18:57:46 +0200 From: Andi Shyti To: Aravind Iddamsetty Subject: Re: [Intel-gfx] [PATCH 1/1] drm/i915/mtl: enable local stolen memory Message-ID: References: <20220920071940.3775059-1-aravind.iddamsetty@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220920071940.3775059-1-aravind.iddamsetty@intel.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx@lists.freedesktop.org, lucas.demarchi@intel.com, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi Aravind, > +static int get_mtl_gms_size(struct intel_uncore *uncore) > +{ > + u16 ggc, gms; > + > + ggc = intel_uncore_read16(uncore, _MMIO(0x108040)); > + > + /* check GGMS, should be fixed 0x3 (8MB) */ > + if ((ggc & 0xc0) != 0xc0) > + return -EIO; > + > + /* return valid GMS value, -EIO if invalid */ > + gms = ggc >> 8; > + switch (gms) { > + case 0x0 ... 0x10: > + return gms * 32; > + case 0x20: > + return 1024; > + case 0x30: > + return 1536; > + case 0x40: > + return 2048; > + case 0xf0 ... 0xfe: just a bit puzzled by the fact that case ranges are not standard and are supported only by GCC, unless, of course, I miss something. Do we still want to use them as they are widely used around the kernel? Andi > + return (gms - 0xf0 + 1) * 4; > + default: > + return -EIO; > + } > +}