Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

agp/intel-gtt: Add intel_gmch_gtt_read_entry()

i915 wants to read out the PTE(s) populated by the BIOS/GOP
to verify that the framebuffer is in the correct location.
Introduce intel_gmch_gtt_read_entry() that reads out the
PTE and decodes it to a somewhat abstract form. For now
we just return the dma_addr, present bit, and local memory
bit. I didn't bother with the snoop bit/etc.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250313140838.29742-4-ville.syrjala@linux.intel.com
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>

+57
+55
drivers/char/agp/intel-gtt.c
··· 53 53 * of the mmio register file, that's done in the generic code. */ 54 54 void (*cleanup)(void); 55 55 void (*write_entry)(dma_addr_t addr, unsigned int entry, unsigned int flags); 56 + dma_addr_t (*read_entry)(unsigned int entry, bool *is_present, bool *is_local); 56 57 /* Flags is a more or less chipset specific opaque value. 57 58 * For chipsets that need to support old ums (non-gem) code, this 58 59 * needs to be identical to the various supported agp memory types! */ ··· 335 334 } 336 335 337 336 writel_relaxed(addr | pte_flags, intel_private.gtt + entry); 337 + } 338 + 339 + static dma_addr_t i810_read_entry(unsigned int entry, 340 + bool *is_present, bool *is_local) 341 + { 342 + u32 val; 343 + 344 + val = readl(intel_private.gtt + entry); 345 + 346 + *is_present = val & I810_PTE_VALID; 347 + *is_local = val & I810_PTE_LOCAL; 348 + 349 + return val & ~0xfff; 338 350 } 339 351 340 352 static resource_size_t intel_gtt_stolen_size(void) ··· 755 741 writel_relaxed(addr | pte_flags, intel_private.gtt + entry); 756 742 } 757 743 744 + static dma_addr_t i830_read_entry(unsigned int entry, 745 + bool *is_present, bool *is_local) 746 + { 747 + u32 val; 748 + 749 + val = readl(intel_private.gtt + entry); 750 + 751 + *is_present = val & I810_PTE_VALID; 752 + *is_local = false; 753 + 754 + return val & ~0xfff; 755 + } 756 + 758 757 bool intel_gmch_enable_gtt(void) 759 758 { 760 759 u8 __iomem *reg; ··· 904 877 intel_private.driver->chipset_flush(); 905 878 } 906 879 EXPORT_SYMBOL(intel_gmch_gtt_insert_sg_entries); 880 + 881 + dma_addr_t intel_gmch_gtt_read_entry(unsigned int pg, 882 + bool *is_present, bool *is_local) 883 + { 884 + return intel_private.driver->read_entry(pg, is_present, is_local); 885 + } 886 + EXPORT_SYMBOL(intel_gmch_gtt_read_entry); 907 887 908 888 #if IS_ENABLED(CONFIG_AGP_INTEL) 909 889 static void intel_gmch_gtt_insert_pages(unsigned int first_entry, ··· 1160 1126 writel_relaxed(addr | pte_flags, intel_private.gtt + entry); 1161 1127 } 1162 1128 1129 + static dma_addr_t i965_read_entry(unsigned int entry, 1130 + bool *is_present, bool *is_local) 1131 + { 1132 + u64 val; 1133 + 1134 + val = readl(intel_private.gtt + entry); 1135 + 1136 + *is_present = val & I810_PTE_VALID; 1137 + *is_local = false; 1138 + 1139 + return ((val & 0xf0) << 28) | (val & ~0xfff); 1140 + } 1141 + 1163 1142 static int i9xx_setup(void) 1164 1143 { 1165 1144 phys_addr_t reg_addr; ··· 1234 1187 .cleanup = i810_cleanup, 1235 1188 .check_flags = i830_check_flags, 1236 1189 .write_entry = i810_write_entry, 1190 + .read_entry = i810_read_entry, 1237 1191 }; 1238 1192 static const struct intel_gtt_driver i8xx_gtt_driver = { 1239 1193 .gen = 2, ··· 1242 1194 .setup = i830_setup, 1243 1195 .cleanup = i830_cleanup, 1244 1196 .write_entry = i830_write_entry, 1197 + .read_entry = i830_read_entry, 1245 1198 .dma_mask_size = 32, 1246 1199 .check_flags = i830_check_flags, 1247 1200 .chipset_flush = i830_chipset_flush, ··· 1254 1205 .cleanup = i9xx_cleanup, 1255 1206 /* i945 is the last gpu to need phys mem (for overlay and cursors). */ 1256 1207 .write_entry = i830_write_entry, 1208 + .read_entry = i830_read_entry, 1257 1209 .dma_mask_size = 32, 1258 1210 .check_flags = i830_check_flags, 1259 1211 .chipset_flush = i9xx_chipset_flush, ··· 1265 1215 .setup = i9xx_setup, 1266 1216 .cleanup = i9xx_cleanup, 1267 1217 .write_entry = i965_write_entry, 1218 + .read_entry = i965_read_entry, 1268 1219 .dma_mask_size = 36, 1269 1220 .check_flags = i830_check_flags, 1270 1221 .chipset_flush = i9xx_chipset_flush, ··· 1276 1225 .setup = i9xx_setup, 1277 1226 .cleanup = i9xx_cleanup, 1278 1227 .write_entry = i965_write_entry, 1228 + .read_entry = i965_read_entry, 1279 1229 .dma_mask_size = 36, 1280 1230 .check_flags = i830_check_flags, 1281 1231 .chipset_flush = i9xx_chipset_flush, ··· 1287 1235 .setup = i9xx_setup, 1288 1236 .cleanup = i9xx_cleanup, 1289 1237 .write_entry = i965_write_entry, 1238 + .read_entry = i965_read_entry, 1290 1239 .dma_mask_size = 36, 1291 1240 .check_flags = i830_check_flags, 1292 1241 .chipset_flush = i9xx_chipset_flush, ··· 1297 1244 .setup = i9xx_setup, 1298 1245 .cleanup = i9xx_cleanup, 1299 1246 .write_entry = i965_write_entry, 1247 + .read_entry = i965_read_entry, 1300 1248 .dma_mask_size = 36, 1301 1249 .check_flags = i830_check_flags, 1302 1250 .chipset_flush = i9xx_chipset_flush, ··· 1308 1254 .setup = i9xx_setup, 1309 1255 .cleanup = i9xx_cleanup, 1310 1256 .write_entry = i965_write_entry, 1257 + .read_entry = i965_read_entry, 1311 1258 .dma_mask_size = 36, 1312 1259 .check_flags = i830_check_flags, 1313 1260 .chipset_flush = i9xx_chipset_flush,
+2
include/drm/intel/intel-gtt.h
··· 28 28 unsigned int pg_start, 29 29 unsigned int flags); 30 30 void intel_gmch_gtt_clear_range(unsigned int first_entry, unsigned int num_entries); 31 + dma_addr_t intel_gmch_gtt_read_entry(unsigned int pg, 32 + bool *is_present, bool *is_local); 31 33 32 34 /* Special gtt memory types */ 33 35 #define AGP_DCACHE_MEMORY 1