€•¦5Œsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”(hhŒparent”hubaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ)/translations/zh_CN/driver-api/io-mapping”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”(hhhh2ubah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ)/translations/zh_TW/driver-api/io-mapping”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”(hhhhFubah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ)/translations/it_IT/driver-api/io-mapping”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”(hhhhZubah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ)/translations/ja_JP/driver-api/io-mapping”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”(hhhhnubah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ)/translations/ko_KR/driver-api/io-mapping”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”(hhhh‚ubah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ)/translations/sp_SP/driver-api/io-mapping”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒThe io_mapping functions”h]”hŒThe io_mapping functions”…””}”(hhªhh¨hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hh£hžhhŸŒC/var/lib/git/docbuild/linux/Documentation/driver-api/io-mapping.rst”h Kubh¢)”}”(hhh]”(h§)”}”(hŒAPI”h]”hŒAPI”…””}”(hh¼hhºhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hh·hžhhŸh¶h KubhŒ paragraph”“”)”}”(hXdThe io_mapping functions in linux/io-mapping.h provide an abstraction for efficiently mapping small regions of an I/O device to the CPU. The initial usage is to support the large graphics aperture on 32-bit processors where ioremap_wc cannot be used to statically map the entire aperture to the CPU as it would consume too much of the kernel address space.”h]”hXdThe io_mapping functions in linux/io-mapping.h provide an abstraction for efficiently mapping small regions of an I/O device to the CPU. The initial usage is to support the large graphics aperture on 32-bit processors where ioremap_wc cannot be used to statically map the entire aperture to the CPU as it would consume too much of the kernel address space.”…””}”(hhÌhhÊhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÈhŸh¶h Khh·hžhubhÉ)”}”(hŒ@A mapping object is created during driver initialization using::”h]”hŒ?A mapping object is created during driver initialization using:”…””}”(hŒ?A mapping object is created during driver initialization using:”hhØhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÈhŸh¶h Khh·hžhubhŒ literal_block”“”)”}”(hŒwstruct io_mapping *io_mapping_create_wc(unsigned long base, unsigned long size)”h]”hŒwstruct io_mapping *io_mapping_create_wc(unsigned long base, unsigned long size)”…””}”(hhhhéubah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hçhŸh¶h Khh·hžhubhÉ)”}”(hŒŒ'base' is the bus address of the region to be made mappable, while 'size' indicates how large a mapping region to enable. Both are in bytes.”h]”hŒ”‘base’ is the bus address of the region to be made mappable, while ‘size’ indicates how large a mapping region to enable. Both are in bytes.”…””}”(hhûhhùhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÈhŸh¶h Khh·hžhubhÉ)”}”(hŒThis _wc variant provides a mapping which may only be used with io_mapping_map_atomic_wc(), io_mapping_map_local_wc() or io_mapping_map_wc().”h]”hŒThis _wc variant provides a mapping which may only be used with io_mapping_map_atomic_wc(), io_mapping_map_local_wc() or io_mapping_map_wc().”…””}”(hj hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÈhŸh¶h Khh·hžhubhÉ)”}”(hŒÂWith this mapping object, individual pages can be mapped either temporarily or long term, depending on the requirements. Of course, temporary maps are more efficient. They come in two flavours::”h]”hŒÁWith this mapping object, individual pages can be mapped either temporarily or long term, depending on the requirements. Of course, temporary maps are more efficient. They come in two flavours:”…””}”(hŒÁWith this mapping object, individual pages can be mapped either temporarily or long term, depending on the requirements. Of course, temporary maps are more efficient. They come in two flavours:”hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÈhŸh¶h Khh·hžhubhè)”}”(hŒÞvoid *io_mapping_map_local_wc(struct io_mapping *mapping, unsigned long offset) void *io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset)”h]”hŒÞvoid *io_mapping_map_local_wc(struct io_mapping *mapping, unsigned long offset) void *io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset)”…””}”(hhhj$ubah}”(h]”h ]”h"]”h$]”h&]”h÷høuh1hçhŸh¶h Khh·hžhubhÉ)”}”(hX"'offset' is the offset within the defined mapping region. Accessing addresses beyond the region specified in the creation function yields undefined results. Using an offset which is not page aligned yields an undefined result. The return value points to a single page in CPU address space.”h]”hX&‘offset’ is the offset within the defined mapping region. Accessing addresses beyond the region specified in the creation function yields undefined results. Using an offset which is not page aligned yields an undefined result. The return value points to a single page in CPU address space.”…””}”(hj4hj2hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÈhŸh¶h K%hh·hžhubhÉ)”}”(hŒThis _wc variant returns a write-combining map to the page and may only be used with mappings created by io_mapping_create_wc()”h]”hŒThis _wc variant returns a write-combining map to the page and may only be used with mappings created by io_mapping_create_wc()”…””}”(hjBhj@hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÈhŸh¶h K+hh·hžhubhÉ)”}”(hŒuTemporary mappings are only valid in the context of the caller. The mapping is not guaranteed to be globally visible.”h]”hŒuTemporary mappings are only valid in the context of the caller. The mapping is not guaranteed to be globally visible.”…””}”(hjPhjNhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÈhŸh¶h K.hh·hžhubhÉ)”}”(hŒ˜io_mapping_map_local_wc() has a side effect on X86 32bit as it disables migration to make the mapping code work. No caller can rely on this side effect.”h]”hŒ˜io_mapping_map_local_wc() has a side effect on X86 32bit as it disables migration to make the mapping code work. No caller can rely on this side effect.”…””}”(hj^hj\hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÈhŸh¶h K1hh·hžhubhÉ)”}”(hŒ”io_mapping_map_atomic_wc() has the side effect of disabling preemption and pagefaults. Don't use in new code. Use io_mapping_map_local_wc() instead.”h]”hŒ–io_mapping_map_atomic_wc() has the side effect of disabling preemption and pagefaults. Don’t use in new code. Use io_mapping_map_local_wc() instead.”…””}”(hjlhjjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÈhŸh¶h K5hh·hžhubhÉ)”}”(hŒtNested mappings need to be undone in reverse order because the mapping code uses a stack for keeping track of them::”h]”hŒsNested mappings need to be undone in reverse order because the mapping code uses a stack for keeping track of them:”…””}”(hŒsNested mappings need to be undone in reverse order because the mapping code uses a stack for keeping track of them:”hjxhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÈhŸh¶h K8hh·hžhubhè)”}”(hŒ¡addr1 = io_mapping_map_local_wc(map1, offset1); addr2 = io_mapping_map_local_wc(map2, offset2); ... io_mapping_unmap_local(addr2); io_mapping_unmap_local(addr1);”h]”hŒ¡addr1 = io_mapping_map_local_wc(map1, offset1); addr2 = io_mapping_map_local_wc(map2, offset2); ... io_mapping_unmap_local(addr2); io_mapping_unmap_local(addr1);”…””}”(hhhj‡ubah}”(h]”h ]”h"]”h$]”h&]”h÷høuh1hçhŸh¶h K;hh·hžhubhÉ)”}”(hŒ The mappings are released with::”h]”hŒThe mappings are released with:”…””}”(hŒThe mappings are released with:”hj•hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÈhŸh¶h KAhh·hžhubhè)”}”(hŒRvoid io_mapping_unmap_local(void *vaddr) void io_mapping_unmap_atomic(void *vaddr)”h]”hŒRvoid io_mapping_unmap_local(void *vaddr) void io_mapping_unmap_atomic(void *vaddr)”…””}”(hhhj¤ubah}”(h]”h ]”h"]”h$]”h&]”h÷høuh1hçhŸh¶h KChh·hžhubhÉ)”}”(hŒÄ'vaddr' must be the value returned by the last io_mapping_map_local_wc() or io_mapping_map_atomic_wc() call. This unmaps the specified mapping and undoes the side effects of the mapping functions.”h]”hŒÈ‘vaddr’ must be the value returned by the last io_mapping_map_local_wc() or io_mapping_map_atomic_wc() call. This unmaps the specified mapping and undoes the side effects of the mapping functions.”…””}”(hj´hj²hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÈhŸh¶h KFhh·hžhubhÉ)”}”(hŒzIf you need to sleep while holding a mapping, you can use the regular variant, although this may be significantly slower::”h]”hŒyIf you need to sleep while holding a mapping, you can use the regular variant, although this may be significantly slower:”…””}”(hŒyIf you need to sleep while holding a mapping, you can use the regular variant, although this may be significantly slower:”hjÀhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÈhŸh¶h KJhh·hžhubhè)”}”(hŒavoid *io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset)”h]”hŒavoid *io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset)”…””}”(hhhjÏubah}”(h]”h ]”h"]”h$]”h&]”h÷høuh1hçhŸh¶h KMhh·hžhubhÉ)”}”(hŒsThis works like io_mapping_map_atomic/local_wc() except it has no side effects and the pointer is globally visible.”h]”hŒsThis works like io_mapping_map_atomic/local_wc() except it has no side effects and the pointer is globally visible.”…””}”(hjßhjÝhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÈhŸh¶h KPhh·hžhubhÉ)”}”(hŒ The mappings are released with::”h]”hŒThe mappings are released with:”…””}”(hŒThe mappings are released with:”hjëhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÈhŸh¶h KShh·hžhubhè)”}”(hŒ"void io_mapping_unmap(void *vaddr)”h]”hŒ"void io_mapping_unmap(void *vaddr)”…””}”(hhhjúubah}”(h]”h ]”h"]”h$]”h&]”h÷høuh1hçhŸh¶h KUhh·hžhubhÉ)”}”(hŒ.Use for pages mapped with io_mapping_map_wc().”h]”hŒ.Use for pages mapped with io_mapping_map_wc().”…””}”(hj hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÈhŸh¶h KWhh·hžhubhÉ)”}”(hŒ;At driver close time, the io_mapping object must be freed::”h]”hŒ:At driver close time, the io_mapping object must be freed:”…””}”(hŒ:At driver close time, the io_mapping object must be freed:”hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÈhŸh¶h KYhh·hžhubhè)”}”(hŒ0void io_mapping_free(struct io_mapping *mapping)”h]”hŒ0void io_mapping_free(struct io_mapping *mapping)”…””}”(hhhj%ubah}”(h]”h ]”h"]”h$]”h&]”h÷høuh1hçhŸh¶h K[hh·hžhubeh}”(h]”Œapi”ah ]”h"]”Œapi”ah$]”h&]”uh1h¡hh£hžhhŸh¶h Kubeh}”(h]”Œthe-io-mapping-functions”ah ]”h"]”Œthe io_mapping functions”ah$]”h&]”uh1h¡hhhžhhŸh¶h Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”h¶uh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(h¦NŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jfŒerror_encoding”ŒUTF-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”h¶Œ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œ embed_images”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(j@j=j8j5uŒ nametypes”}”(j@Nj8Nuh}”(j=h£j5h·uŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nhžhub.