Storage space adjustment method and related apparatus

By dynamically adjusting storage space through a trust zone architecture, the problem of traditional chips being unable to meet the diverse security service requirements is solved. This enables storage space allocation with independent working permissions and modes, improving product availability and user experience.

WO2026067241A1PCT designated stage Publication Date: 2026-04-02HUAWEI TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2025-09-19
Publication Date
2026-04-02

AI Technical Summary

Technical Problem

Traditional microcontroller chips cannot effectively divide the working permissions and working modes of various security services, resulting in poor storage space allocation and failing to meet the needs of security service providers and users.

Method used

By using a trusted zone architecture chip, storage space can be dynamically adjusted using security attribute units and implementation-defined attribute units to ensure independent working permissions and modes for different security services, and to dynamically allocate storage space to meet demand.

Benefits of technology

It enables users to meet their needs, improve product availability and user experience, reduce costs, and ensure independent privileged startup processes and resource allocation for each security service without increasing storage space.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025122504_02042026_PF_FP_ABST
    Figure CN2025122504_02042026_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the present application are a storage space adjustment method and a related apparatus. The method is applied to an electronic device comprising a first chip, which comprises a first storage space for storing downloaded data of a first service and a second storage space for storing downloaded data of a second service, wherein the sum of the size of the first storage space and the size of the second storage space is a first value. The method comprises: receiving an input for downloading first data of a first service; and when the size of the first data is greater than or equal to the size of an unused space in a first storage space, expanding the first storage space, then storing the first data in the expanded first storage space, and prompting that the first data has been downloaded, wherein the size of the unused space in the expanded first storage space is greater than the size of the first data, and when the first storage space is expanded, a second storage space shrinks. In this way, when a plurality of security services are implemented by means of a first chip, storage spaces of the security services can be dynamically separated, so as to meet user requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Storage space adjustment method and related device

[0001] The present application claims priority to the Chinese patent application No. 202411350395.8, filed on September 26, 2024, with the State Intellectual Property Office of China, and entitled "Storage space adjustment method and related device", the whole content of which is incorporated herein by reference. TECHNICAL FIELD

[0002] The present application relates to the technical field of computer, and in particular, to a storage space adjustment method and related device. BACKGROUND

[0003] The traditional chip such as microcontroller unit (MCU) generally has only two working permissions (i.e., privilege and user) and only two working modes (i.e., thread mode and handler mode). A chip can better implement a type of security service. However, with the trend of unification and integration of multiple types of security services, it is necessary to implement multiple types of security services through a chip, for example, to implement near field communication (NFC) services such as bus cards and embedded subscriber identity module (SIM) (eSIM) services such as phone cards through a chip. However, the effect of implementing multiple types of security services through a chip is not good at present, for example, the division effect of working permissions and working modes is not good, the division effect of storage space is not good, and therefore it is unable to meet the needs of the security service leading party and the needs of users. SUMMARY

[0004] The present application discloses a storage space adjustment method and related device, which can meet the needs of the security service leading party and the needs of users when implementing multiple types of security services through a chip.

[0005] In a first aspect, the present application provides a storage space adjustment method applied to an electronic device including a first chip, the first chip including a first storage space and a second storage space, the first storage space being used to store download data of a first service, and the second storage space being used to store download data of a second service. The sum of the sizes of the first storage space and the second storage space is a fixed first value, so when the first storage space increases, the second storage space decreases, and the value of the increase of the first storage space is equal to the value of the decrease of the second storage space. The above method includes: the electronic device receiving a first input of downloading first data of the first service; when the size of the first data is smaller than the size of the unused space in the first storage space, the first chip stores the first data in the first storage space (for example, the first data is an installation package, and the first chip installs the installation package in the first storage space), and the electronic device displays a first prompt information (used to prompt that the first data has been downloaded); when the size of the first data is greater than or equal to the size of the unused space in the first storage space, the first chip increases the first storage space, and because the size of the unused space in the increased first storage space is greater than the size of the first data, the first chip stores the first data in the increased first storage space, and the electronic device displays the first prompt information (used to prompt that the first data has been downloaded).

[0006] In the above method, the first service and the second service can be deployed together in the same first chip, and the first chip can store the download data of different services through different storage spaces. When the user triggers to download the first data of the first service, but the first storage space used to store the download data of the first service is insufficient to download the first data, the first storage space can be increased in real time. Because the sum of the sizes of the first storage space and the second storage space is fixed (it can be understood that the storage space of the first chip is limited), the second storage space will become smaller. It can be understood that the storage space of the security service that the user does not often use / love to use is "divided" to the storage space of the security service that the user often uses / love to use. Therefore, the present application can dynamically divide the storage spaces of multiple security services according to the use demand of the user for the security services, avoid the situation that the security service that the user often uses / love to use cannot download data due to insufficient storage space, and at the same time realize the reutilization of the storage spaces of other security services. In this way, the use demand of the user can be effectively met without increasing the storage space of the first chip, and the cost is reduced.

[0007] In a possible implementation, the first chip comprises a secure attribute unit (SAU) and an implementation-defined attribute unit (IDAU), wherein the SAU is a runtime-dynamically programmable unit for defining a storage space in the first chip, and the IDAU is a programmatically restricted custom unit for providing fixed attributes of the storage space defined by a manufacturer of the first chip. The storage space in the first chip is jointly determined by a corresponding space in the SAU and a corresponding space in the IDAU. For example, the SAU comprises a first space and a second space, a sum of sizes of the first space and the second space is the first value, the IDAU comprises a third space and a fourth space, a sum of sizes of the third space and the fourth space is the first value, the first space and the third space both correspond to a first storage space (for example, have the same address), and the second space and the fourth space both correspond to a second storage space (for example, have the same address). The first storage space is determined according to the corresponding first space in the SAU and the corresponding third space in the IDAU, and the second storage space is determined according to the corresponding second space in the SAU and the corresponding fourth space in the IDAU. Therefore, when the first chip increases the first storage space, the first chip can increase a size of the first space in the SAU by a second value, and obtain the first storage space with the increased second value according to the first space with the increased second value in the SAU and the third space in the IDAU. When the first space increases by the second value, the second space decreases by the second value. When the first storage space increases by the second value, the second storage space decreases by the second value.

[0008] In the above method, the storage space in the first chip can be determined according to the SAU that is dynamically programmable and the IDAU that is programmatically restricted, so that the first storage space can be increased by increasing the corresponding first space in the SAU, the software logic is consistent with the hardware structure of the first chip, and the dynamic partitioning of the storage space of the secure service can be implemented without changing the hardware structure of the first chip, thereby reducing the cost and improving the product usability.

[0009] In a possible implementation, the attribute of the storage space in the first chip is determined by the attribute of the corresponding space in the SAU and the attribute of the corresponding space in the IDAU. For example, the attribute of the first storage space is the attribute with higher priority between the attribute of the first space and the attribute of the third space, and the attribute of the second storage space is the attribute with higher priority between the attribute of the second space and the attribute of the fourth space. The first space has the first attribute, the second space has the second attribute, the attribute of the third space and the attribute of the fourth space have priority lower than or equal to the priority of the first attribute, and the attribute of the third space and the attribute of the fourth space have priority lower than or equal to the priority of the second attribute. Therefore, the first storage space has the first attribute, and the second storage space has the second attribute. When the first chip increases the size of the first space in the SAU by the second value, the attribute of the fifth space with the size of the second value in the second space is modified from the second attribute to the first attribute, and the first space and the fifth space are determined as the first space increased by the second value. When the first chip obtains the first storage space increased by the second value according to the first space increased by the second value in the SAU and the third space in the IDAU, the first attribute of the first storage space increased by the second value is determined according to the first attribute of the first space increased by the second value in the SAU and the attribute of the sixth space in the IDAU, where the sixth space includes the seventh space with the size of the second value in the third space and the fourth space, the fifth space and the seventh space correspond to each other (for example, have the same address), the first storage space increased by the second value includes the third storage space with the size of the second value in the first storage space and the second storage space, and the fifth space and the seventh space both correspond to the third storage space (for example, have the same address). Since the attribute of the third space and the fourth space (including the seventh space) is lower than or equal to the first attribute, the attribute of the sixth space is lower than or equal to the first attribute. Therefore, the attribute of the first storage space increased by the second value determined according to the first attribute of the first space increased by the second value and the attribute of the sixth space is the first attribute.

[0010] In the above method, when the first chip increases the first space in the SAU, the attribute of the space included in the second space in the SAU can be modified to achieve the increase, which is simple and fast, reduces the processing pressure, and is faster.

[0011] In a possible implementation, before the first chip increases the first storage space, it can first determine whether a difference between the size of the unused space in the second storage space and the third value is greater than or equal to a preset threshold (for example, the preset threshold is greater than or equal to 0), the third value being a difference between the size of the first data and the size of the unused space in the first storage space. When the difference between the size of the unused space in the second storage space and the third value is greater than or equal to the preset threshold, the first chip increases the first storage space by a fourth value (the fourth value is greater than or equal to the third value), otherwise, the first storage space is not increased. The third value can be understood as the minimum adjustment size of the second storage space (that is, the minimum adjustment size of the first storage space), that is, the first storage space is increased by at least the third value, and the second storage space is decreased by at least the third value, to successfully store the first data in the increased first storage space.

[0012] In the above method, when the difference between the size of the unused space in the second storage space and the third value is greater than or equal to the preset threshold, that is, the second storage space has enough unused space to "give" the first storage space, the first chip increases the first storage space, and the second storage space is reduced. Avoiding the case that the first chip increases the first storage space when the second storage space does not have enough unused space to "give" the first storage space, resulting in that the data of the first service and / or the second service cannot be normally stored, thereby causing the chip to be abnormal, the fault tolerance is higher, and the product availability is further improved.

[0013] In a possible implementation, the first chip increases the first storage space only when the intelligent installation function of the electronic device is turned on. After the electronic device receives a first input of downloading the first data of the first service, when the size of the first data is greater than or equal to the size of the unused space in the first storage space, the electronic device can first display a first prompt information (used to prompt the user to turn on the intelligent installation function). Then, after the electronic device receives a second input of turning on the intelligent installation function, the first chip increases the first storage space.

[0014] In the above method, the electronic device can prompt the user to turn on the intelligent installation function when it is determined that the first storage space needs to be increased, and increase the first storage space when the second input is received, that is, when the user allows. The selection right is provided to the user, and the user can intuitively feel the dynamic adjustment of the storage space, thereby effectively improving the user experience.

[0015] In a possible implementation, the first chip increases the first storage space only when the smart installation function of the electronic device is enabled. Before the electronic device receives the first input of downloading the first data of the first service, for example, when a download page of the first data is displayed, the second prompt information (for prompting the user to enable the smart installation function) is displayed, and the electronic device can receive a third input of enabling the smart installation function. Then, the electronic device receives the first input of downloading the first data of the first service, and when the size of the first data is greater than or equal to the size of the unused space in the first storage space, because the third input of enabling the smart installation function has been received by the electronic device in advance, the first chip can increase the first storage space. The electronic device determines that the size of the first data is greater than or equal to the size of the unused space in the first storage space, which can be performed before the second prompt information is displayed, or can be performed after the second prompt information is displayed.

[0016] In the above method, the electronic device can prompt the user to enable the smart installation function in advance before receiving the first input, and directly increase the first storage space when the first input is received subsequently, to provide the user with smoother and faster download experience.

[0017] In a possible implementation, the first chip increases the first storage space only when the smart installation function of the electronic device is enabled. The electronic device enables the smart installation function by default, so that the first storage space can be directly increased without user operation, reducing user operation and improving user experience.

[0018] In a possible implementation, the first chip increases the first storage space only when the smart installation function of the electronic device is enabled. Before the electronic device receives the first input of downloading the first data of the first service, the electronic device receives a user input of enabling the smart installation function in a setting interface. Then, the electronic device receives the first input of downloading the first data of the first service, and when the size of the first data is greater than or equal to the size of the unused space in the first storage space, because the user input of enabling the smart installation function has been received by the electronic device in advance, the first chip can increase the first storage space.

[0019] In the above method, the user can select whether to enable the smart installation function in the setting interface, to provide the user with more flexible operation experience.

[0020] In a possible implementation, the first chip is a chip of Trustzone architecture, the first chip includes a first area and a second area, the first area is used to deploy and run the first service, and the second area is used to deploy and run the second service, the storage space of the first area includes the first storage space, and the storage space of the second area includes the second storage space.

[0021] In some examples, the first region is a secure zone and the second region is a non-secure zone, or the first region is a non-secure zone and the second region is a secure zone.

[0022] The first region and the second region have independent working permissions and independent working modes. In some examples, the working permissions of the first region include first user permissions and first privileged permissions, the working permissions of the second region include second user permissions and second privileged permissions, the working mode of the first region includes a first thread mode and a first handler mode, and the working mode of the second region includes a second thread mode and a second handler mode.

[0023] In the above method, the first chip is a chip of a Trustzone architecture, and the working permissions and the working modes of different services deployed in different regions of the first chip are decoupled and separated. Therefore, the first service and the second service can each have an independent privileged startup process, an independent privileged interrupt process, an independent privileged operating system (OS) scheduling and resource allocation, an independent user applet deployment, and an independent thread mode and an independent handler mode, which well meets the needs of the first service and the second service.

[0024] In a possible implementation, the first chip increases the first storage space in the secure region, and stores the first data in the increased first storage space in the first region. The first region is a secure region or a non-secure region. The priority of the secure region is higher than that of the non-secure region.

[0025] In the above method, the first storage space can be successfully increased in the secure region with a higher priority, regardless of whether the first region is a secure region or a non-secure region.

[0026] In a possible implementation, before the electronic device receives the first input, the first chip performs a system startup process, which includes: power-on and loading of the first chip, initialization of a Trustzone architecture of the first chip, resource initialization of a secure region and service initialization of the secure region in the secure region of the first chip, resource initialization of a non-secure region in the secure region of the first chip, and service initialization of the non-secure region in the non-secure region of the first chip. The priority of the secure region is higher than that of the non-secure region.

[0027] In the method, the resource initialization and the service initialization of the secure area and the resource initialization of the non-secure area are first implemented in the secure area, and then the service initialization of the secure area is implemented in the non-secure area, that is, the resource initialization of the two areas is first completed in the secure area with higher priority, so as to prepare for subsequent service initialization and service use, avoid the situation that the resource initialization of the non-secure area cannot be effectively completed in the non-secure area with lower priority, and thus the use of the second service is affected, and the service use experience of the user is ensured.

[0028] In a possible implementation, the first service is a near field communication (NFC) service, and the second service is an embedded subscriber identity module (eSIM) service. In another possible implementation, the first service is an eSIM service, and the second service is an NFC service. For example, the priority of the eSIM service is higher than the priority of the NFC service, and the priority of the secure area is higher than the priority of the non-secure area, so the service deployed in the secure area is the eSIM service, and the service deployed in the non-secure area is the NFC service, which can ensure the experience of the eSIM service with higher priority and meet the user demand.

[0029] In a second aspect, the present application provides a chip system, comprising a processing circuit and an interface circuit, the interface circuit is configured to receive a code instruction and transmit the code instruction to the processing circuit, and the processing circuit is configured to run the code instruction to execute the storage space adjustment method provided in the first aspect and any one of the implementation manners of the first aspect.

[0030] In a third aspect, the present application provides an electronic device, comprising a transceiver, a processor and a memory, the memory is configured to store a computer program, and the processor is configured to call the computer program to execute the storage space adjustment method provided in the first aspect and any one of the implementation manners of the first aspect.

[0031] In a fourth aspect, the present application provides an electronic device, comprising a first chip, and the first chip is configured to execute the storage space adjustment method provided in the first aspect and any one of the implementation manners of the first aspect.

[0032] In a fifth aspect, the present application provides a computer storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program is configured to implement the storage space adjustment method provided in the first aspect and any one of the implementation manners of the first aspect.

[0033] In a sixth aspect, the present application provides a computer program product, comprising a computer program, and when the computer program is executed on a processor, the computer program is configured to implement the storage space adjustment method provided in the first aspect and any one of the implementation manners of the first aspect.

[0034] It should be understood that the description of technical features, technical solutions, advantages or similar language in this application does not imply that all features and advantages can be realized in any single implementation. Instead, it can be understood that the description of a feature or advantage means that the specific technical feature, technical solution or advantage is included in at least one implementation. Therefore, the description of technical features, technical solutions or advantages in this application does not necessarily refer to the same implementation. Further, the technical features, technical solutions and advantages described in this application can be combined in any appropriate manner. Those skilled in the art will understand that the present application can be implemented without one or more specific technical features, technical solutions or advantages of a particular implementation. In other implementations, additional technical features and advantages can be identified in specific implementations that do not embody all implementations. BRIEF DESCRIPTION OF DRAWINGS

[0035] The following describes the drawings used in this application.

[0036] Figure 1 is a schematic diagram of the hardware structure of an electronic device provided by the present application;

[0037] Figure 2 is a schematic diagram of the architecture of a chip system provided by the present application;

[0038] Figure 3 is a schematic diagram of the architecture of a chip provided by the present application;

[0039] Figures 4-8 are schematic diagrams of the structure of some chips provided by the present application;

[0040] Figure 9 is a schematic diagram of the flow of a deployment process provided by the present application;

[0041] Figure 10 is an example schematic diagram of a deployment process provided by the present application;

[0042] Figure 11 is a schematic diagram of the flow of a storage space adjustment method provided by the present application;

[0043] Figure 12 is a schematic diagram of the structure of yet another chip provided by the present application;

[0044] Figures 13A-13C are schematic diagrams of some user interfaces provided by the present application;

[0045] Figure 14 is a schematic diagram of the flow of yet another storage space adjustment method provided by the present application;

[0046] Figure 15 is a schematic diagram of the structure of yet another chip provided by the present application;

[0047] Figures 16A-16C are schematic diagrams of some user interfaces provided by the present application;

[0048] Figure 17 is a schematic diagram of the memory of a chip provided by the present application;

[0049] FIG. 18 is a structural schematic diagram of another chip provided in the present application;

[0050] FIG. 19 is a flow schematic diagram of another storage space adjustment method provided in the present application;

[0051] FIG. 20 is a hardware structural schematic diagram of another electronic device provided in the present application. DETAILED DESCRIPTION

[0052] The technical solutions in the embodiments of the present application will be described below with reference to the drawings. The terms used in the implementation manner part of the embodiments of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.

[0053] In the description of the embodiments of the present application, unless otherwise specified, " / " represents the meaning of or, for example, A / B can represent A or B; "and / or" in the text only describes the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B, which can represent three cases of A alone, A and B together, and B alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

[0054] Hereinafter, the terms "first" and "second" are only used for description purposes, and cannot be understood as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Therefore, the features defined with "first" and "second" can explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" is two or more than two.

[0055] In the embodiments of the present application, the electronic device 100 can be any one of a mobile phone, a tablet computer, a handheld computer, a desktop computer, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), and a smart large screen, a smart sound box, and other smart home devices, a smart bracelet, a smart watch, smart glasses, and other wearable devices, augmented reality (AR), virtual reality (VR), mixed reality (MR), and other extended reality (XR) devices, a vehicle-mounted device or a smart city device, and the like.

[0056] It can be understood that the electronic device 100 illustrated in the embodiments of the present application is only an example, and the electronic device 100 can have more or fewer components than illustrated, can combine two or more components, or can have a different component configuration. The various components illustrated can be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.

[0057] FIG. 1 is a schematic diagram of a hardware structure of an electronic device 100 according to an embodiment of the present application.

[0058] As shown in FIG. 1, the electronic device 100 can include a processor 101 and a chip system 102. The processor 101 can be one or more central processing units (CPUs). In the case where the processor 101 is a CPU, the CPU can be a single-core CPU or a multi-core CPU. The processor 101 can be configured to execute processing logic of the electronic device 100, such as starting / closing an application of the electronic device 100, starting / closing a function of a security service, and the like.

[0059] The chip system 102 can include one or more chips, each of which can be, but is not limited to, a microcontroller unit (MCU). The chips in the chip system 102 can be configured to implement a security service of the electronic device 100, in which case the chips can also be referred to as security chips. The security service of the electronic device 100 can include, for example but not limited to, a near field communication (NFC) service and an embedded subscriber identity module (SIM) (eSIM) service, and the like. The NFC service can be a service of an NFC analog card (such as a card opening service, a card swiping service, and the like), and the NFC analog card can include, for example but not limited to, an access control card, a vehicle key / door key, a transportation card, a bank card, a digital currency, a digital certificate, and the like. The eSIM service can be a service of a profile of a SIM card (such as a profile downloading service, a profile activating service, a profile deleting service, and the like). Compared with a traditional SIM solution (i.e., inserting a SIM card into a SIM card slot of the electronic device 100, and the electronic device 100 performing network access through the inserted SIM card), the eSIM solution can package card information of one or more SIM cards into an independent profile, and the electronic device 100 can download the profile through a network to use as a SIM card, and the electronic device 100 can perform network access through the profile.

[0060] In an implementation, the chip system 102 in the electronic device 100 includes a plurality of chips, and different types of secure services are deployed in different chips of the plurality of chips. For a specific example, refer to FIG. 2.

[0061] FIG. 2 exemplarily shows an architecture diagram of a chip system. The chip system shown in FIG. 2 can be the chip system 102 shown in FIG. 1.

[0062] The chip system shown in FIG. 2 can include a chip A and a chip B. The chip A and the chip B can be a traditional architecture, such as an ARMv7 architecture before ARMv8, etc. The chip A and the chip B of the traditional architecture each only has two working permissions: privilege and user, and each only has two working modes: thread mode and handler mode. The working permission of privilege can be used to implement system / chip startup, handle an operating system (OS), handle various interrupt services, etc., and the working permission of privilege has full resources of the chip / system. The working permission of user can be used to handle applets and other user services, and the working permission of user has partial resources of the chip / system. The thread mode can be used to handle the OS and handle applets and other user services, and the thread mode can include both the working permissions of privilege and user. The handler mode can be used to implement system / chip startup, handle various interrupt services, etc., and the handler mode only includes the working permission of privilege.

[0063] As shown in FIG. 2, a first secure service can be deployed in chip A, and a second secure service can be deployed in chip B. For example, the first secure service is an eSIM service, and the second secure service is an NFC service. Chip A can include an applet of the first secure service and a chip operating system (COS) of the first secure service. Chip B can include an applet of the second secure service and a COS of the second secure service. In chip A, the applet of the first secure service can be processed using a user's work authority, and the applet of the first secure service can be processed in a thread mode. Also, the COS of the first secure service can be processed in a privileged work authority, and the COS of the first secure service can be processed in a thread mode or a handler mode. In chip B, the applet of the second secure service can be processed using a user's work authority, and the applet of the second secure service can be processed in a thread mode. Also, the COS of the second secure service can be processed in a privileged work authority, and the COS of the second secure service can be processed in a thread mode or a handler mode. Chip A can include a corresponding input / output (I / O) interface. Chip B can also include a corresponding I / O interface. The I / O interface can be used for communication between the chip and the outside (for example, the processor 101 in the electronic device 100 and other modules).

[0064] With the trend of unification and integration of multiple types of secure services, it is necessary to implement multiple types of secure services through one chip, which has the advantage of low cost. However, if a chip with a traditional architecture (for example, chip A / chip B shown in FIG. 2) is used to implement multiple types of secure services, the needs of the dominant party of the multiple types of secure services cannot be met. Because the dominant party of each type of secure service often hopes to have independent work authorities and independent work modes that are decoupled / separated from other secure services, for example, the dominant party of each type of secure service hopes to have independent privileged startup processes, independent privileged interrupt processes, independent privileged OS scheduling and resource allocation, and independent user applet deployment. The dominant party of each type of secure service hopes to have independent thread modes and independent handler modes. But a chip with a traditional architecture has only two work modes and two work authorities, and the work modes and work authorities cannot be further divided.

[0065] In the embodiments of the present application, the chip with the Trustzone architecture can be used to implement multiple types of security services, and the working mode and working authority can be re-divided, so as to meet the requirements of the dominant party of the multiple types of security services. For details, refer to FIG. 3.

[0066] FIG. 3 is a schematic diagram of an architecture of a chip 300 according to an embodiment of the present application. The chip 300 shown in FIG. 3 can be the chip system 102 shown in FIG. 1.

[0067] The chip 300 shown in FIG. 3 can be a chip with the Trustzone architecture, for example, the architecture of ARMv8 and later. The chip 300 with the Trustzone architecture can include a secure zone and a non-secure zone that are isolated in hardware and / or software. The secure zone can have independent working authorities: privilege 1 and user 1, and independent working modes: thread mode 1 and handler mode 1. The non-secure zone has independent working authorities: privilege 2 and user 2, and independent working modes: thread mode 2 and handler mode 2.

[0068] As shown in FIG. 3, the first secure service and the second secure service can be deployed in different regions of the chip 300. FIG. 3 illustrates an example in which the first secure service is deployed in the secure zone of the chip 300 and the second secure service is deployed in the non-secure zone of the chip 300. In some embodiments, the secure zone has a higher priority than the non-secure zone. In some embodiments, the first secure service deployed in the secure zone has a higher priority than the second secure service deployed in the non-secure zone. For example, the first secure service is an eSIM service and the second secure service is an NFC service, and the eSIM service has a higher priority than the NFC service. The secure zone of the chip 300 can include an applet of the first secure service and a COS of the first secure service. The non-secure zone of the chip 300 can include an applet of the second secure service and a COS of the second secure service. In the secure zone of the chip 300, the applet of the first secure service can be processed using the working authority of the user 1 and can be processed in the thread mode 1. Also, the COS of the first secure service can be processed using the working authority of the privilege 1 and can be processed in the thread mode 1 or the handler mode 1. In the non-secure zone of the chip 300, the applet of the second secure service can be processed using the working authority of the user 2 and can be processed in the thread mode 2. Also, the COS of the second secure service can be processed using the working authority of the privilege 2 and can be processed in the thread mode 2 or the handler mode 2. The secure zone of the chip 300 can include a corresponding I / O interface (for communication between the secure zone and the outside). The non-secure zone of the chip 300 can include a corresponding I / O interface (for communication between the non-secure zone and the outside).

[0069] Next, the structure of the chip 300 of the Trustzone architecture is exemplarily introduced.

[0070] FIGS. 4-8 are structural schematic diagrams of some chips 300 provided by embodiments of the present application.

[0071] As shown in FIG. 4, the chip 300 can include a processing unit 310, an I / O interface 320, a memory 330, and an implementation defined attribution unit (IDAU) 340. The processing unit 310, the I / O interface 320, the memory 330, and the IDAU 340 can be connected through a bus 350. The processing unit 310 can include a register 311, a security attribution unit (SAU) 312, and an IDAU interface 313. In some examples, the processing unit 310 can be a CPU.

[0072] The processing unit 310 can be configured to read instructions in the memory of the chip 300 and execute the instructions. The memory of the chip 300 can include the register 311 inside the processing unit 310, and the memory 330 outside the processing unit 310.

[0073] The register 311 can be a buffer memory and can be configured to temporarily store instructions, data, and addresses, etc. The register 311 can be directly randomly accessed by the processing unit 310. In some embodiments, the register 311 in the processing unit 310 can include a stack pointer (SP). The SP can include a master stack pointer (MSP) and a process stack pointer (PSP). The MSP can be used for the OS and exception events. The PSP can be used for user programs. In some embodiments, the address stored in the register 311 can be used to point to a location / storage space in the memory of the chip 300 (i.e., addressing). In some embodiments, the data stored in the register 311 can be used to perform arithmetic and logical operations.

[0074] The memory 330 can be configured to store programs and data of the chip 300. The memory 330 can include, but is not limited to, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read only memory (EPROM), a non-volatile memory (Flash), etc.

[0075] The I / O interface 320 can be used to implement the chip 300 and external (for example, other modules such as processors in the electronic device 100 except the chip 300). The chip 300 can include a plurality of I / O interfaces 320. Among them, the secure zone of the chip 300 can include one or more I / O interfaces 320. The non-secure zone of the chip 300 can include one or more I / O interfaces 320.

[0076] It can be understood that the Trustzone technology can divide various resources of the chip 300, such as memory, into a secure zone and a non-secure zone. For example, the processing unit 310 shown in FIG. 5 can include a secure zone and a non-secure zone, for example, the registers 311 in the processing unit 310 can include a secure zone and a non-secure zone. The secure zone and the non-secure zone of the processing unit 310 can respectively include corresponding SPs, that is, the SPs of different regions can be decoupled / separated. Among them, in the secure zone, under the thread mode 1, the PSP of the secure zone (which can be represented as PSP S) and the limit PSP (which can be represented as PSPLIM S) of the secure zone can be included, and the PSPLIM S can be used to limit the value of the PSP, for example, as the maximum value. Under the handler mode 1, the MSP of the secure zone (which can be represented as MSP S) and the limit MSP (which can be represented as MSPLIM S) of the secure zone can be included, and the MSPLIM S can be used to limit the value of the MSP S, for example, as the maximum value. In the non-secure zone, under the thread mode 2, the PSP of the non-secure zone (which can be represented as PSP NS) and the limit PSP (which can be represented as PSPLIM NS) of the non-secure zone can be included, and the PSPLIM NS can be used to limit the value of the PSP NS, for example, as the maximum value. Under the handler mode 2, the MSP of the non-secure zone (which can be represented as MSP NS) and the limit MSP (which can be represented as MSPLIM NS) of the non-secure zone can be included, and the MSPLIM NS can be used to limit the value of the MSP NS, for example, as the maximum value. For example, the memory 330 shown in FIG. 6 can include a secure zone and a non-secure zone, and the secure zone can include a non-secure callable (NSC) region. Not limited to this, in other examples, the secure zone in the processing unit 310 (for example, the registers 311) can also include an NSC region.

[0077] The memory of the chip 300 can include multiple attributes, and the storage spaces in different regions can be of different attributes. Among them, the attribute of the storage space in the secure zone of the memory is a secure attribute, the attribute of the storage space in the NSC region of the memory is an NSC attribute, and the attribute of the storage space in the non-secure zone of the memory is a non-secure attribute.

[0078] In some embodiments, the attribute of the storage space in the memory of the chip 300 is determined jointly by the SAU 312 and the IDAU 340. The SAU 312 is a unit that can be dynamically programmed at runtime and can be used to define the attribute of a certain storage space in the memory of the chip 300. The IDAU 340 is a custom unit with programming restrictions and can provide fixed attributes of the memory defined by the manufacturer of the chip 300. It can be understood that the SAU 312 and the IDAU 340 are not used to store data, but to map (also referred to as correspond to) the storage space in the memory of the chip 300, thereby determining the attribute of the corresponding / mapped storage space in the memory of the chip 300. For implementation examples, see FIG. 7 below.

[0079] As shown in FIG. 7, the processing unit 310 in the chip 300 can include the SAU 312, the IDAU interface 313, and the calculation module 314. The IDAU 340 in the chip 300 can include the IDAU response module 341. The processing unit 310 can determine the attribute of any storage space in the memory of the chip 300 through the SAU 312 and the IDAU 340. The following is described by taking the address 1 as an example. The processing unit 310 can input the address 1 in the memory of the chip 300 into the SAU 312 to obtain the attribute 1 of the address 1 in the SAU (i.e., the attribute 1 of the address corresponding to the address 1 in the SAU). The processing unit 310 can input the address 1 into the IDAU interface 313, wherein the IDAU interface 313 can send the address 1 to the IDAU response module 341 in the IDAU 340 and receive the attribute 2 of the address 1 in the IDAU sent by the IDAU response module 341, so that the processing unit 310 can obtain the attribute 2 of the address 1 in the IDAU (i.e., the attribute 2 of the address corresponding to the address 1 in the IDAU) through the IDAU interface 313. Then, the processing unit 310 can input the attribute 1 and the attribute 2 into the calculation module 314. The calculation module 314 can obtain the attribute 3 of the address 1 in the memory according to the attribute 1 and the attribute 2 according to a preset algorithm (i.e., the actual attribute of the address 1 in the memory). In some examples, the attribute 3 is the attribute with higher priority in the attribute 1 and the attribute 2. For example, when the attribute 1 and the attribute 2 are secure attribute and non-secure attribute respectively, the attribute 3 is the secure attribute with higher priority, when the attribute 1 and the attribute 2 are secure attribute and NSC attribute respectively, the attribute 3 is the secure attribute with higher priority, and when the attribute 1 and the attribute 2 are NSC attribute and non-secure attribute respectively, the attribute 3 is the NSC attribute with higher priority.

[0080] As shown in FIG. 5, the processing unit 310 can be in a secure state corresponding to a secure zone or in a non-secure state corresponding to a non-secure zone. The processing unit 310 in the secure state can have two working modes: thread mode 1 and handler mode 1, and can have two working permissions: user 1 and privilege 1 (not shown). The processing unit 310 in the non-secure state can have two working modes: thread mode 2 and handler mode 2, and can have two working permissions: user 2 and privilege 2 (not shown). In the Trustzone technology, when the processing unit 310 accesses data / instructions in the memory of the chip 300, for example, the following rules are followed: the processing unit 310 in the secure state can only execute instructions in the memory with a secure attribute, and cannot execute instructions in the memory with a non-secure attribute; the processing unit 310 in the secure state can access data in the memory with a secure attribute, and can also access data in the memory with a non-secure attribute; the processing unit 310 in the non-secure state can only execute instructions in the memory with a non-secure attribute, and cannot execute instructions in the memory with a secure attribute; the processing unit 310 in the non-secure state can only access data in the memory with a non-secure attribute, and cannot access data in the memory with a secure attribute.

[0081] It can be understood that in the Trustzone technology, the program (for example, code) running in the non-secure zone cannot directly access the program running in the secure zone, and the program running in the secure zone can directly access the program running in the non-secure zone. As shown in FIG. 8, the function in the secure zone that can be called by the function in the non-secure zone can be referred to as a non-secure entry function, and the function in the non-secure zone that can be called by the function in the secure zone can be referred to as a non-secure call function. In some embodiments, the non-secure function in the non-secure zone can call the non-secure entry function in the secure zone through a secure gateway (SG) instruction in the NSC area. It can be understood that the non-secure function needs to jump to the NSC area to execute the SG instruction first, and then jump to the non-secure entry function to execute. After the execution of the non-secure entry function, it returns to the non-secure function. In some embodiments, the secure function in the secure zone can directly call the non-secure call function in the non-secure zone. After the execution of the non-secure call function, it returns to the secure function.

[0082] The deployment process of the chip 300 is exemplarily introduced below.

[0083] FIG. 9 is a flow diagram of a deployment process according to an embodiment of the present application. The deployment process shown in FIG. 9 can include but is not limited to the following steps:

[0084] 1. Create an engineering file 1 of the chip 300 on the electronic device 400, wherein the attribute of the engineering file 1 is set to secure.

[0085] The electronic device 400 can be used to implement the deployment process of the chip 300, and the electronic device 400 is, for example but not limited to, a computer or the like. The electronic device 400 is similar to the electronic device 100 described above. In some embodiments, when creating the engineering file 1 of the chip 300 on the electronic device 400, the model of the processor (such as a CPU) of the engineering file 1 can be set as the model of the chip 300.

[0086] For example, as shown in step 1 of FIG. 10, a new project file (i.e., the engineering file 1) Test\Test_s.project can be created, and the path of the new project file can be Test\Test_s.project, and the file name of the new project file can be Test_s.project. The Test_s.project can be set with properties, i.e., the properties can be set as secure. The Test_s.project can be set with deployment, i.e., the start address and the end address of the memory of the Test_s.project can be set, for example, the memory of the Test_s.project includes Flash and RAM, and the start address and the end address of the Flash can be set as start address 1 and end address 1 respectively, and the start address and the end address of the RAM can be set as start address 2 and end address 2 respectively. The Test_s.project can be set with CPU selection, for example, the model of the chip 300 is ARM v8 Trustzone, and the CPU selection of the Test_s.project can be set as ARM v8 Trustzone.

[0087] 2. Create the engineering file 2 of the chip 300 on the electronic device 400, and set the properties of the engineering file 2 as non-secure.

[0088] In some embodiments, when creating the engineering file 2 of the chip 300 on the electronic device 400, the processor (such as a CPU) of the engineering file 2 can be set as the model of the chip 300. It can be understood that the processors of the engineering file 1 and the engineering file 2 deployed on the chip 300 are the same (i.e., both are the chip 300), but the properties of the engineering file 1 and the engineering file 2 are different, and the deployment addresses of the engineering file 1 and the engineering file 2 are also different.

[0089] Exemplarily, as shown in step 2 of FIG. 10, a new project file (i.e., project file 2) Test\Test_ns.project can be created, and the path of the new project file can be Test\Test_ns.project, and the file name of the new project file can be Test_ns.project. In this case, the attribute of Test_ns.project can be set as non-secure, the deployment of Test_ns.project can be set, for example, the start address and the end address of the memory of Test_ns.project can be set as start address 3 and end address 3 respectively for the Flash, and start address 4 and end address 4 respectively for the RAM, and the memory of Test_ns.project can include the Flash and the RAM, and the CPU of Test_ns.project can be selected as ARM v8 Trustzone.

[0090] 3. Set the output object file 1 in the project file 1.

[0091] Exemplarily, as shown in step 3 of FIG. 10, the output of Test_s.project (i.e., project file 1) can be set, and the output file (i.e., output object file 1) can be Test_s_Lib.o, wherein the file name (i.e., Test_s_Lib.o) of the file includes the file name (i.e., Test_s) of the project file 1 where the file is located, and the type of the file is object.

[0092] 4. Refer to the output object file 1 in the project file 1 in the project file 2.

[0093] Exemplarily, as shown in step 4 of FIG. 10, the linker of Test_ns.project (i.e., project file 2) can be set, and the file of the linker can be Test_s_Lib.o (i.e., output object file 1).

[0094] 5. Create a multi-project workspace on the electronic device 400, and compile the project file 1 and the project file 2 together in the multi-project workspace.

[0095] Exemplarily, as shown in step 5 of FIG. 10, the Multi-project workspace is created, and the Test_s.project (i.e., Project 1) and the Test_ns.project (i.e., Project 2) are compiled together. The paths under the Project entry after the compilation can include the path of the Test_s.project (i.e., Test\Test_s.project), and the path of the Test_ns.project (i.e., Test\Test_ns.project). The WorkSpace after the compilation can include two Projects: Test_s (i.e., the Project after the compilation of the Test_s.project) and Test_ns (i.e., the Project after the compilation of the Test_ns.project). The Project Test_s can include Secure Code, Interface, Documentation, and Device. The Secure Code of the Project Test_s can include the main function (file name: main_s.c) of the secure area. The Interface of the Project Test_s can include the interface file (file name: interface.c). The Documentation of the Project Test_s can include the description file (file name: Abstract.txt) of the Test_s.project. The Device of the Project Test_s can include the partition file (file name: partition.h) for the SAU, which can also be understood as the SAU setup file. The Project Test_ns can include Non-Secure Code and Library. The Non-Secure Code of the Project Test_ns can include the main function (file name: main_ns.c) of the non-secure area. The Library of the Project Test_ns can be the secure reference library required by the security component, i.e., the file library in the Project Test_s required by the Project Test_ns, and therefore, the Library of the Project Test_ns can include the file Test_s_Lib.o (i.e., Output Object File 1) set by the linker.

[0096] In the above embodiment, the chip 300 is of a Trustzone architecture, and includes a Trustzone processor, in which the work permissions and work modes of different security services are decoupled / separated, so that the dominators of different security services can independently / isolately deploy the corresponding security services, i.e., the isolation of the installation domain is implemented. Moreover, the chip 300 includes processor-level independent hardware registers, in which the work permissions and work modes of different security services are decoupled / separated, so that the dominators of different security services can independently / isolately run the corresponding security services, i.e., the isolation of the running domain is implemented. In this way, the first security service and the second security service can have independent privileged startup flows, independent privileged interrupt flows, independent privileged OS scheduling and resource allocation, independent user applet deployment, and independent thread modes and independent handler modes, which well meet the needs of the dominator of the first security service and the dominator of the second security service.

[0097] Although the chip 300 in the above embodiment implements the redivision of the work permissions and work modes, the division of the storage spaces of different security services is still not good. Because the storage spaces of different security services on the chip 300 are pre-divided, but the preferences / habits of different users in using security services are not the same, the pre-divided storage spaces can not meet the needs of the users. For example, the user 1 is more used to using the NFC service, so the storage space of the NFC service is likely to be insufficient, resulting in that the user cannot download new NFC simulation cards or other related data, but the storage space of the eSIM service can be sufficient. Or, the user 2 can be more used to using the NFC service in a period of time, so the storage space of the NFC service is likely to be insufficient, but can be more used to using the eSIM service in another period of time, so the storage space of the eSIM service is likely to be insufficient. That is, the chip 300 cannot dynamically isolate and divide the memory resources of the chip 300 according to the use needs of the users for the security services, which can result in that a certain type of security service cannot normally download data due to insufficient storage space, and the storage space of another security service is wasted.

[0098] The embodiment of the present application provides a storage space adjustment method, which can be applied to the chip 300. The chip 300 can determine the attribute of the storage space in the memory by integrating the processor-level SAU and the system-level IDAU. For specific description, refer to FIG. 7. Based on the characteristics of the chip 300, when a user triggers to download data of a certain type of security service, and the storage space of the type of security service is insufficient to download the data, the method can redivide the storage space of the security service by the SAU, so that the storage space of the type of security service becomes larger (sufficient to download the data). At this time, since the sum of the sizes of the storage spaces of the plurality of security services is fixed, the storage space of the other security service becomes smaller. For example, when the user triggers to download data of a second security service in the non-secure zone, but the storage space of the second security service (the attribute is non-secure, that is, the storage space belonging to the non-secure zone) is insufficient to download the data, the storage space of the non-secure zone is increased by the SAU, and the storage space of the secure zone becomes smaller. In this way, the storage space of the second security service becomes larger, which can be used to download the data, and the storage space of the first security service becomes smaller. Therefore, the embodiment of the present application can dynamically adjust the isolation division of the firewall of the storage space in the chip 300 based on the use demand of the user on any type of security service, avoid the situation that the data of the security service cannot be downloaded due to insufficient storage space, meet the use demand of the user, and realize the reuse of the storage space of the other security service, so that the product usability is better.

[0099] The embodiment of the present application can regard the boundary between the storage spaces of different security services in the same chip as a firewall. For example, in the chip 300 shown in FIG. 3, the boundary between the storage space of the first security service and the storage space of the second security service can be regarded as a firewall, which can be understood as isolating the storage spaces of different security services by the firewall. The firewall can be understood as a software firewall.

[0100] The storage space of the security service described in the embodiment of the present application is the storage space for storing the download data of the security service. It can be understood that the download data of the security service is downloaded after the chip 300 is used, and therefore, the download data of the security service can also be called post-download data.

[0101] The storage space adjustment method in different application scenarios is exemplarily introduced below.

[0102] Application scenario 1: a user starts application 1, where application 1 can provide a function related to a second secure service in the non-secure zone. The user can trigger the download of data of the second secure service in application 1, and the following takes the installation package 1 of the applet that triggers the download and installation of the second secure service as an example for illustration.

[0103] FIG. 11 is a flow diagram of a storage space adjustment method provided by an embodiment of the present application. The method shown in FIG. 11 can be applied to application scenario 1. The method shown in FIG. 11 can be applied to the electronic device 100 shown in FIG. 1, where the chip system 102 in the electronic device 100 can be the chip 300 shown in at least one of FIG. 3-FIG. 8. The method shown in FIG. 11 is described below by taking the chip 300 shown in FIG. 12 as an example. The method shown in FIG. 11 can include but is not limited to the following steps:

[0104] S101: The electronic device 100 receives a user input of starting application 1.

[0105] In some embodiments, after the electronic device 100 receives the user input of starting application 1, the electronic device 100 can start application 1 and display a user interface of application 1. Application 1 can provide a function related to a second secure service, for example, the second secure service is an NFC service, and application 1 is a wallet application, and application 1 can provide services such as downloading an NFC simulation card, card swiping, and card deletion.

[0106] In some embodiments, the second secure service needs to be normally used after the corresponding function switch is turned on, for example, the second secure service is an NFC service, and the NFC service can be normally used after the NFC function switch of the electronic device 100 is turned on. In some examples, the electronic device 100 can turn on the function switch corresponding to the second secure service by default when starting application 1. Without limitation, in another example, the electronic device 100 can also prompt the user to turn on the function switch corresponding to the second secure service when starting application 1.

[0107] FIG. 11 takes the example of automatically or prompting the user to manually turn on the function switch corresponding to the second secure service after the electronic device 100 receives the user input of starting application 1, and in another example, the electronic device 100 can also turn on the function switch corresponding to the second secure service automatically or in response to the user operation before receiving the user input of starting application 1. When the electronic device 100 turns on the function switch corresponding to the second secure service, the chip system 102 that carries the second secure service can be started, that is, the system starting process shown in S102-S104 is executed.

[0108] S102: The chip system 102 in the electronic device 100 performs power-on, secure boot, and Trustzone initialization in the secure zone.

[0109] S103: The chip system 102 in the electronic device 100 implements the startup process of the secure zone in the secure zone.

[0110] S104: The chip system 102 in the electronic device 100 implements the startup process of the non-secure zone in the non-secure zone.

[0111] Exemplarily, the chip system 102 is the chip 300 shown in FIG. 12. As shown in FIG. 12, when the user starts the application program 1 of the electronic device 100, the function switch corresponding to the second secure service in the electronic device 100 can be turned on, thereby triggering the startup of the chip 300. First, the power-on and secure boot of the chip 300 can be performed by the power-on loading module in the secure zone of the chip 300, and the Trustzone initialization of the chip 300 can be implemented by the Trustzone initialization module in the secure zone of the chip 300, that is, S102 of FIG. 11 is executed. Then, the startup process of the secure zone can be implemented by the secure zone main function module (for example, main_s.c shown in FIG. 10) in the secure zone of the chip 300, that is, S103 of FIG. 11 is executed. Finally, the startup process of the non-secure zone can be implemented by the non-secure zone main function module (for example, main_ns.c shown in FIG. 10) in the non-secure zone of the chip 300, that is, S104 of FIG. 11 is executed.

[0112] The specific implementation process of the system startup process shown in S102-S104 above can be referred to FIG. 18 below.

[0113] S105: The electronic device 100 receives the user input of downloading the small program of the second secure service.

[0114] In some embodiments, after the chip system 102 in the electronic device 100 completes the system startup procedure, the electronic device 100 can receive a user input of downloading an applet of a second secure service, and determine an installation package 1 of the applet according to the user input, so that the service downloading procedure shown in S106-S113 can be performed. For example, the second secure service is an NFC service, and the application 1 is a wallet application. The electronic device 100 can receive a user input of downloading an NFC simulation card in the wallet application, and determine an installation package 1 of an applet corresponding to the NFC simulation card according to the user input.

[0115] In some examples, the second secure service is an NFC service, and the application 1 is a wallet application. As shown in FIG. 13A, the electronic device 100 can display a user interface 1310 of the wallet application, and the user interface 1310 can be an opening interface of an “A place transportation card”. The user interface 1310 can include a schematic diagram of the “A place transportation card”, selectable recharging amounts, a card opening fee, and a “confirm payment” control 1311. The electronic device 100 can receive a user operation (e.g., a click operation) acting on the control 1311, i.e., receive a user input of downloading an applet of a second secure service (currently an applet of the “A place transportation card”), and perform S106-S108 in response to the user operation.

[0116] S106: The chip system 102 in the electronic device 100 acquires a size (sizeA) of an installation package 1 of an applet of a second secure service in a non-secure area.

[0117] S107: The chip system 102 in the electronic device 100 acquires a size (sizeB) of available storage space of the non-secure area in the non-secure area.

[0118] In the above, the available storage space of the non-secure area is the available storage space in the storage space for storing post-download data of the second secure service.

[0119] In the above, the implementation order of S106 and S107 is not limited.

[0120] S108: The chip system 102 in the electronic device 100 determines whether sizeA is greater than or equal to sizeB in the non-secure area.

[0121] In some embodiments, the chip system 102 judges whether the size A is greater than or equal to the size B in the non-secure zone. When the result of the judgment is yes (i.e., the size A is greater than or equal to the size B), it can be understood that the available storage space in the non-secure zone is not enough for the installation package 1 of the second security service, and the chip system 102 can execute the adjustment (i.e., increase) of the storage space of the second security service in the secure zone, i.e., S109-S111. When the result of the judgment is no (i.e., the size A is less than the size B), it can be understood that the available storage space in the non-secure zone is enough for the installation package 1 of the second security service, and the chip system 102 can directly install the installation package 1 of the second security service in the non-secure zone, i.e., S112. In some examples, the chip system 102 needs to execute the adjustment of the storage space of the second security service under the work permission of the corresponding privilege 1 in the secure zone.

[0122] Exemplarily, the chip system 102 is the chip 300 shown in FIG. 12. As shown in FIG. 12, when the user triggers the applet for downloading the second security service, the electronic device 100 can trigger an interrupt to the non-secure zone main function module (e.g., the main_ns.c shown in FIG. 10) in the non-secure zone. The non-secure zone main function module can execute S106-S108 shown in FIG. 11 through the judgment module in the non-secure zone according to the interrupt of the input. When the judgment module in the non-secure zone determines that the size A is greater than or equal to the size B (which can be referred to as case 1), the corresponding operation can be executed by the trigger module in the non-secure zone. Optionally, when the trigger module in the non-secure zone executes the corresponding operation in case 1, the chip system 102 can notify the outside (e.g., other modules in the electronic device 100 except the chip system 102) of the waiting delay, so as to avoid the outside considering that the chip system 102 is abnormal (e.g., dead). When the judgment module in the non-secure zone determines that the size A is less than the size B (which can be referred to as case 2), the installation module in the non-secure zone can install the installation package 1 (i.e., execute S112 shown in FIG. 11).

[0123] The trigger module in the non-secure zone can be a non-secure callable function, which can trigger (or be understood as entering or calling) the entry module in the secure zone through the SG instruction in the NSC area. For example, the non-secure callable function can be a non-secure function shown in FIG. 8, and the entry module in the secure zone can be a non-secure entry function shown in FIG. 8. In case 1, when the trigger module in the non-secure zone triggers the entry module in the secure zone, the trigger module can pass the end addresses corresponding to sizeA and sizeB (i.e., the end addresses of the available storage space of the non-secure zone) to the entry module, so that the entry module passes the end addresses corresponding to sizeA and sizeB to the SAU control module in the secure zone, for the SAU control module to perform the adjustment of the storage space of the second security service based on the end addresses corresponding to sizeA and sizeB. The entry module in the secure zone can jump to the privileged module in the secure zone, and the privileged module adjusts the working privilege from user 1 to privilege 1. For example, the privileged module can execute the interrupt vector in the request management call (SVC) privilege (SVC_Handler) system to call to adjust the working privilege to privilege 1. After the privileged module in the secure zone adjusts the working privilege to privilege 1, it can jump to the SAU control module in the secure zone, and the SAU control module dynamically adjusts the SAU under the working privilege of privilege 1 to complete the adjustment of the storage space of the second security service. The SAU control module can perform S109-S111 and S113 shown in FIG. 11.

[0124] In some embodiments, when the chip system 102 determines that the size A is greater than or equal to the size B in the non-secure zone (i.e., the result of the determination of S108 is YES), the electronic device 100 can display a prompt information to prompt the user whether to continue to install the installation package 1 of the applet of the second secure service under the smart installation function. When the user selects to continue to install, the adjustment of the storage space of the second secure service is performed again (i.e., S109-S111 are executed), and when the user selects to cancel the installation, S109-S111 are not executed and the installation is ended. The smart installation function can be a function of allowing to adaptively adjust the storage space of the first secure service and / or the second secure service. In some examples, the second secure service is an NFC service, and the application 1 is a wallet application. When the result of the determination of S108 is YES, the electronic device 100 can display the user interface 1320 shown in FIG. 13B, which can be a card opening interface in which the "A city traffic card" is being opened. For example, the user interface 1320 can be displayed by the electronic device 100 in response to a user operation on the control 1311 in the user interface 1310 shown in FIG. 13A. The user interface 1320 can include a prompt box 1321, which can include a prompt information "Smart installation: the space of the secure chip is limited, and the space adjustment is being performed", a control 1321A of "Continue to open the card" and a control 1321B of "Cancel to open the card". The control 1321A can be used for the user to select to start the smart installation function and continue to install under the smart installation function, and the electronic device 100 can determine that the user selects to continue to install under the smart installation function in response to a user operation (e.g., a click operation) on the control 1321A, and thus the adjustment of the storage space of the second secure service can be performed (i.e., S109-S111 are executed). The control 1321B can be used for the user to select to cancel the installation.

[0125] Not limited to the above embodiments, in other embodiments, the electronic device 100 can also display the prompt information before performing S108 to prompt the user whether to start the smart installation function. In the case that the user starts the smart installation function, when the result of S108 is yes, S109-S111 can be directly performed. In the case that the user does not start the smart installation function, when the result of S108 is yes, the installation can be directly ended, or the user can be prompted again whether to start the smart installation function (the description of this case is similar to the description of the above embodiments). In some examples, the electronic device 100 displays the prompt information before S105 and receives the user operation of selecting to start the smart installation function. For example, as shown in FIG. 13C, the electronic device 100 can display the user interface 1330 of the wallet application, which is similar to the user interface 1310 shown in FIG. 13A. Among them, the user interface 1330 further includes a prompt box 1331, which can include the prompt information “the space of the secure chip is limited, and the smart installation (authorized firewall management, adaptive space size) can be started” of the smart installation function and a starting control 1331A, which can be used to start the smart installation function. The electronic device 100 can first receive the user operation (such as a click operation) acting on the starting control 1331A, and start the smart installation function in response to the user operation. Then the electronic device 100 can receive the user operation (such as a click operation) acting on the control 1311, and perform S106-S108 in response to the user operation. Since the smart installation function has been started, when the result of S108 is yes, the electronic device 100 can directly perform S109-S111 and S113.

[0126] S109: The chip system 102 in the electronic device 100 acquires the size (sizeC) of the available storage space of the secure area in the secure area.

[0127] In some embodiments, the available storage space of the above-mentioned secure area is the available storage space in the storage space for storing the post-download data of the first secure service.

[0128] S110: The chip system 102 in the electronic device 100 judges whether (sizeA-sizeB) is less than sizeC in the secure area.

[0129] In some embodiments, (sizeA - sizeB) can be the minimum adjustment size of the storage space of the second secure service, i.e. the storage space of the second secure service needs to be enlarged by at least (sizeA - sizeB) to successfully install the installation package 1 of the second secure service in the storage space of the second secure service. The second secure service is deployed in the non-secure zone, and thus the attribute of the storage space of the second secure service is non-secure, i.e. the storage space of the second secure service belongs to the storage space of the non-secure zone. Since the sum of the storage space of the secure zone and the storage space of the non-secure zone is fixed, if the storage space of the non-secure zone needs to be enlarged, part of the storage space in the secure zone needs to be modified to the storage space of the non-secure zone, which can be understood as "allocating" the storage space of the secure zone to the non-secure zone. Therefore, before enlarging the storage space of the non-secure zone, the chip system 102 needs to determine whether the available storage space of the secure zone is sufficient to be "allocated" to the non-secure zone, i.e. whether the minimum adjustment size (sizeA - sizeB) of the above-mentioned storage space of the second secure service is less than the size sizeC of the available storage space of the secure zone, i.e. whether the available storage space of the secure zone is greater than 0 after being reduced by (sizeA - sizeB). It can also be understood as determining whether the available storage space of the secure zone is greater than 0 after "allocating" the storage space of (sizeA - sizeB) in the available storage space of the secure zone to the non-secure zone.

[0130] When the result of the judgment is yes (i.e., (sizeA-sizeB) is less than sizeC), the chip system 102 can increase the storage space of the non-secure zone, i.e., perform S111. When the result of the judgment is no (i.e., (sizeA-sizeB) is greater than or equal to sizeC), the chip system 102 can not adjust the storage space of the non-secure zone, e.g., perform S113. It can be understood that when the available storage space of the secure zone is enough to "allocate" to the non-secure zone, the storage space of the non-secure zone can be increased, otherwise it is not adjusted. It can also be understood that when the available storage space of the secure zone is greater than 0 after "allocating" the storage space of (sizeA-sizeB) in size to the non-secure zone, the storage space of the non-secure zone can be increased, otherwise it is not adjusted.

[0131] S111: The chip system 102 in the electronic device 100 expands the storage space of the non-secure zone in the secure zone, wherein the available storage space of the expanded non-secure zone is sizeB', and sizeB' is greater than sizeA.

[0132] In some embodiments, when (sizeA-sizeB) is less than sizeC, the chip system 102 can increase the size of the available storage space of the non-secure zone from sizeB to sizeB', and correspondingly, the size of the available storage space of the secure zone is reduced from sizeC to sizeC', (sizeB'-sizeB) and (sizeC-sizeC') are equal. Since sizeB' is greater than sizeA, the increased available storage space of the non-secure zone is enough to download the installation package 1.

[0133] In some embodiments, the chip system 102 can increase the size of the available storage space of the non-secure zone mapped in the SAU from sizeB to sizeB', and decrease the size of the available storage space of the non-secure zone mapped in the SAU from sizeC to sizeC', where (sizeB'-sizeB) and (sizeC-sizeC') are equal. Since the size of the available storage space of the non-secure zone mapped in the IDAU and the size of the available storage space of the secure zone mapped in the IDAU are fixed, the size of the available storage space of the non-secure zone in the memory obtained according to the SAU and the IDAU is also increased from sizeB to sizeB', and the size of the available storage space of the secure zone in the memory obtained according to the SAU and the IDAU is also decreased from sizeC to sizeC'. For implementation examples, refer to FIG. 17 below.

[0134] In some embodiments, the chip system 102 can first obtain the end address corresponding to sizeB, and parse the storage space corresponding to the end address (i.e., the available storage space of the non-secure zone). Then, the storage space corresponding to the end address can be expanded so that the size of the expanded available storage space is sizeB' which is greater than sizeA. In some examples, the chip system 102 can obtain the end address mapped by sizeB in the SAU, and parse the space corresponding to the end address (i.e., the space of the non-secure zone in the SAU). Then, the space corresponding to the end address in the SAU can be expanded so that the size of the expanded space is sizeB' which is greater than sizeA.

[0135] In some embodiments, when the chip system 102 implements the expansion of the available storage space of the non-secure zone, the chip system 102 can modify the attribute of the space of size (sizeC-sizeC') in the secure zone from secure to non-secure in the SAU, for example, modify the attribute of the space of size (sizeC-sizeC') after / before the end address corresponding to sizeB from secure to non-secure, so that the space of size (sizeC-sizeC') becomes the space of the non-secure zone. For implementation examples, refer to FIG. 17 below.

[0136] S112: The chip system 102 in the electronic device 100 installs the installation package 1 of the small program of the second secure service in the non-secure area.

[0137] In some embodiments, when the result of S108 is false, i.e., the size of the installation package 1 sizeA is smaller than the size of the available storage space of the non-secure zone sizeB, the chip system 102 directly installs the installation package 1 in the non-secure zone, i.e., stores the data of the installation package 1 in the available storage space of the non-secure zone.

[0138] In some embodiments, when the result of S108 is true, i.e., the size of the installation package 1 sizeA is greater than or equal to the size of the available storage space of the non-secure zone sizeB, the chip system 102 can expand the storage space of the second secure service in the secure zone, and then (i.e., after performing S111) can go to the non-secure zone. Since the size of the available storage space of the non-secure zone has been increased to sizeB’ (sizeB’ is greater than the size of the installation package 1 sizeA) at this time, the chip system 102 can successfully install the installation package 1 of the second secure service in the non-secure zone, i.e., store the data of the installation package 1 in the available storage space of the non-secure zone.

[0139] S113: The chip system 102 in the electronic device 100 notifies the non-secure zone of the storage space adjustment failure in the secure zone.

[0140] In some embodiments, when (sizeA-sizeB) is greater than or equal to sizeC, i.e., the result of S110 is false, it can be understood that the available storage space of the secure zone is not enough to “allocate” to the non-secure zone, and the chip system 102 can notify the non-secure zone of the storage space adjustment failure in the secure zone. Therefore, the chip system 102 can not install the installation package 1 of the second secure service in the non-secure zone (i.e., end the service download process).

[0141] Exemplarily, the chip system 102 is the chip 300 shown in FIG. 12. As shown in FIG. 12, in case 1, the SAU control module in the secure zone of the chip 300 can perform S109-S110 shown in FIG. 11. When the result of S110 is yes, the SAU control module can perform S111 shown in FIG. 11, and return the indication information of success to the trigger module in the non-secure zone, to inform the trigger module that the storage space adjustment is successful. After receiving the indication information of success, the trigger module can jump to the installation module in the non-secure zone, and the installation module performs S112 shown in FIG. 11. When the result of S110 is no, the SAU control module can perform S113 shown in FIG. 11, that is, return the indication information of failure to the trigger module in the non-secure zone, to inform the trigger module that the storage space adjustment fails. After receiving the indication information of failure, the trigger module can end the service download process.

[0142] The above embodiments take the example of performing S106-S108 after S105. In other embodiments, the electronic device 100 can also perform S106-S108 before S105. In some examples, the electronic device 100 performs S106-S108 when receiving a user input of opening the download service of the small program of the second secure service, and then the electronic device 100 can perform S105. The electronic device 100 can select whether to perform S109-S110 in combination with the judgment result of S108 and whether the user opens the smart installation function. Alternatively, the electronic device 100 can prompt the user with the judgment result of S108 and prompt the user to select whether to open the smart installation function, to facilitate the user to select. For example, when the electronic device 100 receives a user input of opening the download interface of “A place traffic card”, the electronic device 100 performs S106-S108 first, and displays the download interface of “A place traffic card” according to the judgment result of S108. Take the user interface 1330 shown in FIG. 13C as an example. The display content of the prompt box 1331 in the user interface 1330 shown in FIG. 13C is determined according to the judgment result of S108. FIG. 13C takes the example that the judgment result of S108 is yes, so the prompt information displayed by the prompt box 1331 includes “the space of the secure service is limited”. The user can select whether to open the smart installation function (such as whether to click the opening control 1331A in the user interface 1330) in combination with the prompt information displayed by the prompt box 1331. When the user selects to open the smart installation function and the judgment result of S108 is yes, the electronic device 100 can perform S109-S113. However, in other examples, the display content of the prompt box 1331 in the user interface 1330 shown in FIG. 13C can not be determined according to the judgment result of S108. No matter what the judgment result of S108 is, “the space of the secure service is limited” can be displayed in the prompt box 1331.

[0143] The above embodiments take the example of directly ending the service download process when the judgment result of S110 is no. In other embodiments, when the judgment result of S110 is no, S113 can not be performed, and the chip system 102 in the electronic device 100 can also delete data in the secure zone to the non-secure zone, for example, automatic deletion or prompting the user to manually delete, and then perform S107 and S108 after deletion. In other embodiments, when the judgment result of S110 is no, the chip system 102 in the electronic device 100 can also delete data in the secure zone, for example, automatic deletion or prompting the user to manually delete, and then perform S110 after deletion. When the data cannot be deleted any more and the judgment result of S110 is no, S113 can be performed.

[0144] In the above embodiments, when judging whether the available storage space of the secure zone is sufficient to "allocate" to the non-secure zone, it is judged whether (sizeA-sizeB) is less than sizeC, that is, whether (sizeC-(sizeA-sizeB)) is greater than or equal to 0, which can be understood as judging whether the available storage space of the secure zone (sizeC) is greater than 0 after "allocating" (sizeA-sizeB) storage space to the non-secure zone. Not limited to this, in other embodiments, S110 can also be to judge whether (sizeC-(sizeA-sizeB)) is greater than or equal to a preset threshold, which can be understood as judging whether the available storage space of the secure zone is greater than or equal to the preset threshold after "allocating" (sizeA-sizeB) storage space to the non-secure zone. In this way, the available storage space can be reserved for the first secure service in the secure zone, avoiding the use of the first secure service being affected, and the user experience is better.

[0145] Application scenario 2: the user starts the application program 2, wherein the application program 2 can provide the related function of the first secure service in the secure zone. And the user can trigger the download of the data of the first secure service in the application program 2, and the following will be described by taking the installation package 2 of the applet of the first secure service as an example.

[0146] FIG. 14 is a flow diagram of a storage space adjustment method provided by an embodiment of the present application. The method shown in FIG. 14 can be applied to application scenario 1. The method shown in FIG. 14 can be applied to the electronic device 100 shown in FIG. 1, wherein the chip system 102 in the electronic device 100 can be the chip 300 shown in at least one of FIGS. 3-8. The method shown in FIG. 14 will be described by taking the chip 300 shown in FIG. 15 as an example. The method shown in FIG. 14 can include but is not limited to the following steps:

[0147] S201: The electronic device 100 receives a user input of starting the application program 2.

[0148] In some embodiments, after the electronic device 100 receives the user input of starting the application program 2, the application program 2 can be started, and the user interface of the application program 2 can be displayed. The application program 2 can provide the related function of the first secure service, for example, the first secure service is an eSIM service, and the application program 2 is a network / telephone application, and the application program 2 can provide the download, activation, deletion, etc. of the profile of the eSIM.

[0149] In some embodiments, the first secure service can only be normally used after the corresponding function switch is turned on. For example, the first secure service is an eSIM service, and the eSIM function (e.g., mobile communication function) switch of the electronic device 100 is turned on before the eSIM service can be normally used. In some examples, the electronic device 100 can turn on the function switch corresponding to the first secure service by default when starting the application 2. However, in other examples, the electronic device 100 can also prompt the user to turn on the function switch corresponding to the first secure service when starting the application 2.

[0150] FIG. 14 illustrates an example in which the electronic device 100 automatically or prompts the user to manually turn on the function switch corresponding to the first secure service after receiving the user input of starting the application 2. In other examples, the electronic device 100 can also automatically or in response to the user operation turn on the function switch corresponding to the first secure service before receiving the user input of starting the application 2. When the electronic device 100 turns on the function switch corresponding to the first secure service, the chip system 102 carrying the first secure service can be started, that is, the system starting process shown in S202-S204 is executed.

[0151] S202: The chip system 102 in the electronic device 100 performs on-chip power-on, secure loading, and Trustzone initialization in the secure zone.

[0152] S203: The chip system 102 in the electronic device 100 implements the starting process of the secure zone in the secure zone.

[0153] S204: The chip system 102 in the electronic device 100 implements the starting process of the non-secure zone in the non-secure zone.

[0154] S202-S204 of FIG. 14 are consistent with S102-S104 of FIG. 11. Therefore, the specific implementation process of the system starting process shown in S202-S204 can also be referred to FIG. 18 below.

[0155] Exemplarily, the chip system 102 is a chip 300 shown in FIG. 15. As shown in FIG. 15, when the user starts the application 2 of the electronic device 100, a function switch corresponding to the first secure service in the electronic device 100 can be turned on, thereby triggering the start of the chip 300. First, a power on and secure boot can be performed by a power on and load module in a secure zone of the chip 300, and a Trustzone initialization module in the secure zone of the chip 300 can implement Trustzone initialization, i.e., S202 of FIG. 14 is executed. Then, a secure zone main function module (e.g., main_s.c shown in FIG. 10) in the secure zone of the chip 300 can implement a start flow of the secure zone, i.e., S203 of FIG. 14 is executed. Finally, a non-secure zone main function module (e.g., main_ns.c shown in FIG. 10) in a non-secure zone of the chip 300 can implement a start flow of the non-secure zone, i.e., S204 of FIG. 14 is executed.

[0156] S205: The electronic device 100 receives a user input of downloading an applet of the first secure service.

[0157] In some embodiments, after the chip system 102 in the electronic device 100 completes the system start flow, the electronic device 100 can receive a user input of downloading an applet of the first secure service, and determine an installation package 2 of the applet according to the user input, so that the service download flow shown in S206-S213 can be executed. For example, the second secure service is an eSIM service, and the application 2 is a network application. The electronic device 100 can receive a user input of purchasing a traffic package in the network application, and determine an installation package 2 (such as a profile) of an eSIM applet corresponding to the traffic package according to the user input.

[0158] In some examples, the first secure service is an eSIM service, and the application 2 is a network application. As shown in FIG. 16A, the electronic device 100 can display a user interface 1610 of the network application, and the user interface 1610 can be a purchase interface of “1 day traffic in country B”. The user interface 1610 can include introduction information of “1 day traffic in country B”, selectable payment methods, a payment amount, and a control 1611 of “confirm payment”. The electronic device 100 can receive a user operation (such as a click operation) on the control 1611, i.e., receive a user input of downloading an applet of the first secure service (currently an applet of “1 day traffic in country B”), and execute S206-S208 in response to the user operation.

[0159] S206: The chip system 102 in the electronic device 100 acquires the size (sizeD) of the installation package 2 of the first secure service applet in the secure zone.

[0160] S207: The chip system 102 in the electronic device 100 acquires the size (sizeE) of the available storage space in the secure zone.

[0161] In some embodiments, the available storage space in the secure zone is the available storage space in the storage space for storing the post-download data of the first secure service.

[0162] In some embodiments, the implementation sequence of S206 and S207 is not limited.

[0163] S208: The chip system 102 in the electronic device 100 judges whether sizeD is greater than or equal to sizeE in the secure zone.

[0164] In some embodiments, the chip system 102 judges whether sizeD is greater than or equal to sizeE in the secure zone. When the obtained judgment result is yes (i.e., sizeD is greater than or equal to sizeE), it can be understood that the available storage space in the secure zone is not enough to download the installation package 2, and the adjustment (i.e., the increase) of the storage space of the first secure service can be performed in the secure zone, i.e., S209-S211 are performed. When the obtained judgment result is no (i.e., sizeD is less than sizeE), it can be understood that the available storage space in the secure zone is enough to download the installation package 2, and the installation package 2 of the second secure service can be directly installed in the secure zone, i.e., S212 is performed. In some examples, the chip system 102 needs to perform the adjustment of the storage space of the first secure service under the working permission of the corresponding privilege 1 in the secure zone.

[0165] Exemplarily, the chip system 102 is the chip 300 shown in FIG. 15. As shown in FIG. 15, when the user triggers the applet for downloading the first secure service, the electronic device 100 can trigger an interrupt to a main function module in the secure zone (e.g., the main_s.c shown in FIG. 10). The main function module in the secure zone can execute S206-S208 shown in FIG. 14 through a judgment module in the secure zone according to the interrupt of the input. When the judgment module in the secure zone determines that the sizeD is greater than or equal to the sizeE (which can be referred to as case 1), the adjustment of the storage space of the first secure service can be implemented through a privilege module and a SAU control module in the secure zone. Optionally, when the adjustment of the storage space of the first secure service is implemented through the privilege module and the SAU control module in the secure zone in case 1, the chip system 102 can notify an external (e.g., other modules in the electronic device 100 except the chip system 102) of a waiting delay to avoid the external considering that the chip system 102 is abnormal (e.g., dead). When the judgment module in the secure zone determines that the sizeD is less than the sizeE (which can be referred to as case 2), the installation package 2 can be installed by an installation module in the secure zone (i.e., S212 shown in FIG. 14 is executed). In case 1, the judgment module in the secure zone can jump to the privilege module in the secure zone, and the privilege module adjusts the working privilege from the user 1 to the privilege 1, for example, the privilege module can call an interrupt vector execution in the SVC_Handler system to adjust the working privilege to the privilege 1. After the privilege module in the secure zone adjusts the working privilege to the privilege 1, the privilege module can jump to the SAU control module in the secure zone, and the SAU control module dynamically adjusts the SAU under the working privilege of the privilege 1 to complete the adjustment of the storage space of the first secure service. The SAU control module can execute S209-S211 and S213 shown in FIG. 14.

[0166] In some embodiments, when the chip system 102 determines that the sizeD is greater than or equal to the sizeE in the secure zone (i.e., the determination result of S208 is YES), the electronic device 100 can display a prompt information to prompt the user whether to continue to install the installation package 2 of the applet of the first security service under the smart installation function. When the user selects to continue to install, the adjustment of the storage space of the first security service is performed again (i.e., S209-S211 are executed), and when the user selects to cancel the installation, S209-S211 are not executed and the installation is ended. In some examples, the first security service is an eSIM service, and the application 2 is a network application. When the determination result of S208 is YES, the electronic device 100 can display a user interface 1620 as shown in FIG. 16B, which can be an installation interface of the eSIM card corresponding to the "B country 1 day traffic" package, for example, the user interface 1620 can be displayed by the electronic device 100 in response to the user operation on the control 1611 in the user interface 1610 shown in FIG. 16A. The user interface 1620 can include a prompt box 1621, which can include a prompt information "smart installation: the space of the secure chip is limited, and the space adjustment is in progress", a control 1621A of "continue to install" and a control 1621B of "cancel the installation". The control 1621A can be used for the user to select to start the smart installation function and continue to install under the smart installation function, and the electronic device 100 can determine that the user selects to continue to install under the smart installation function in response to the user operation (such as a click operation) on the control 1621A, and thus the adjustment of the storage space of the first security service can be performed (i.e., S209-S211 are executed). The control 1621B can be used for the user to select to cancel the installation.

[0167] Not limited to the above embodiments, in other embodiments, the electronic device 100 can also display the prompt information before S208 is executed to prompt the user whether to start the smart installation function. In the case that the user starts the smart installation function, when the result of S208 is yes, S209-S211 can be directly executed. In the case that the user does not start the smart installation function, when the result of S208 is yes, the installation can be directly ended, or the user can be prompted again whether to start the smart installation function (the description of this case is similar to that of the above embodiments). In some examples, the electronic device 100 displays the prompt information before S205 and receives the user operation of selecting to start the smart installation function. For example, as shown in FIG. 16C, the electronic device 100 can display a user interface 1630 of the network application, which is similar to the user interface 1610 shown in FIG. 16A. Among them, the user interface 1630 further includes a prompt box 1631, which can include the prompt information “the space of the secure chip is limited, and the smart installation (authorized firewall management, adaptive space size) can be started” of the smart installation function and a starting control 1631A, which can be used to start the smart installation function. The electronic device 100 can first receive the user operation (such as a click operation) acting on the starting control 1631A, and start the smart installation function in response to the user operation. Then the electronic device 100 can receive the user operation (such as a click operation) acting on the control 1611, and execute S206-S208 in response to the user operation. Since the smart installation function has been started, when the result of S208 is yes, the electronic device 100 can directly execute S209-S211 and S213.

[0168] S209: The chip system 102 in the electronic device 100 acquires the size (sizeF) of the available storage space of the non-secure area in the non-secure area.

[0169] In some embodiments, the available storage space of the non-secure area is the available storage space in the storage space for storing the post-download data of the second secure service.

[0170] S210: The chip system 102 in the electronic device 100 judges whether (sizeD-sizeE) is less than sizeF in the secure area.

[0171] In some embodiments, (sizeD - sizeE) can be the minimum adjustment size of the storage space of the first secure service, i.e. the storage space of the first secure service needs to be enlarged by (sizeD - sizeE) at least to successfully install the installation package 2 of the first secure service in the storage space of the first secure service. The first secure service is deployed in the secure zone, and thus the attribute of the storage space of the first secure service is secure, i.e. the storage space of the first secure service belongs to the storage space of the secure zone. Since the sum of the storage space of the secure zone and the storage space of the non-secure zone is fixed, if the storage space of the secure zone needs to be enlarged, part of the storage space in the storage space of the non-secure zone needs to be modified to the storage space of the secure zone, which can be understood as "allocating" the storage space of the non-secure zone to the secure zone. Therefore, before enlarging the storage space of the secure zone, the chip system 102 needs to determine whether the available storage space of the non-secure zone is sufficient to be "allocated" to the secure zone, i.e. whether the minimum adjustment size (sizeD - sizeE) of the above-mentioned storage space of the first secure service is less than the size sizeF of the available storage space of the non-secure zone, i.e. whether the available storage space of the non-secure zone is greater than 0 after being reduced by (sizeD - sizeE). It can also be understood as determining whether the available storage space of the non-secure zone is greater than 0 after "allocating" the storage space of (sizeD - sizeE) in the available storage space of the non-secure zone to the secure zone.

[0172] When the result of the judgment is yes (i.e., (sizeD-sizeE) is less than sizeF), the chip system 102 can increase the storage space of the secure zone, i.e., perform S211. When the result of the judgment is no (i.e., (sizeD-sizeE) is greater than or equal to sizeF), the chip system 102 can not adjust the storage space of the secure zone, e.g., perform S213. It can be understood that when the available storage space of the non-secure zone is enough to be "allocated" to the secure zone, the storage space of the secure zone can be increased, otherwise it is not adjusted. It can also be understood that when the available storage space of the non-secure zone is greater than 0 after (sizeD-sizeE) size of the available storage space of the non-secure zone is "allocated" to the secure zone, the storage space of the secure zone can be increased, otherwise it is not adjusted.

[0173] S211: The chip system 102 in the electronic device 100 expands the storage space of the secure zone in the secure zone, wherein the size of the available storage space of the expanded secure zone is sizeE', and sizeE' is greater than sizeD.

[0174] In some embodiments, when (sizeD-sizeE) is less than sizeF, the chip system 102 can increase the size of the available storage space of the secure zone from sizeE to sizeE', and correspondingly, the size of the available storage space of the non-secure zone is reduced from sizeF to sizeF', (sizeE'-sizeE) and (sizeF-sizeF') are equal. Since sizeE' is greater than sizeD, the increased available storage space of the secure zone is enough to download the installation package 2.

[0175] In some embodiments, the chip system 102 can increase the size of the available storage space of the secure zone mapped in the SAU from sizeE to sizeE', decrease the size of the available storage space of the non-secure zone mapped in the SAU from sizeF to sizeF', and make (sizeE' - sizeE) and (sizeF - sizeF') equal. Since the size of the available storage space of the non-secure zone mapped in the IDAU and the size of the available storage space of the secure zone mapped in the IDAU are fixed, the size of the available storage space of the non-secure zone in the memory obtained according to the SAU and the IDAU is also increased from sizeE to sizeE', and the size of the available storage space of the secure zone in the memory obtained according to the SAU and the IDAU is also decreased from sizeF to sizeF'. For implementation examples, refer to FIG. 17 below.

[0176] In some embodiments, the chip system 102 can first obtain the end address corresponding to sizeE, and parse the storage space corresponding to the end address (i.e., the available storage space of the secure zone). Then, the storage space corresponding to the end address can be expanded so that the size of the expanded available storage space is sizeE' which is greater than sizeD. In some examples, the chip system 102 can obtain the end address mapped by sizeE in the SAU, and parse the space corresponding to the end address (i.e., the space of the secure zone in the SAU). Then, the space corresponding to the end address in the SAU can be expanded so that the size of the expanded space is sizeE' which is greater than sizeD.

[0177] In some embodiments, when the chip system 102 implements the expansion of the available storage space of the secure zone, the chip system 102 can modify the attribute of the space of size (sizeF - sizeF') in the secure zone from non-secure to secure in the SAU, for example, modify the attribute of the space of size (sizeF - sizeF') after / before the end address corresponding to sizeE from non-secure to secure, so that the space of size (sizeF - sizeF') becomes the space of the secure zone. For implementation examples, refer to FIG. 17 below.

[0178] S212: The chip system 102 in the electronic device 100 installs the installation package 2 of the small program of the first security service in the secure area.

[0179] In some embodiments, when the result of S208 is no, i.e., the size of the installation package 2 sizeD is smaller than the size of the available storage space of the secure zone sizeE, the chip system 102 directly installs the installation package 2 in the secure zone, i.e., stores the data of the installation package 2 in the available storage space of the secure zone.

[0180] In some embodiments, when the result of S208 is yes, i.e., the size of the installation package 2 sizeD is greater than or equal to the size of the available storage space of the secure zone sizeE, the chip system 102 can perform the expansion of the storage space of the secure zone for the first security service, and after S211 is performed, since the size of the available storage space of the secure zone has been increased to sizeE’ (sizeE’ is greater than the size of the installation package 2 sizeD), the chip system 102 can successfully install the installation package 2 of the first security service in the secure zone, i.e., store the data of the installation package 2 in the available storage space of the secure zone.

[0181] S213: The chip system 102 in the electronic device 100 determines that the storage space adjustment in the secure zone fails, and ends the installation.

[0182] In some embodiments, when (sizeD-sizeE) is greater than or equal to sizeF, i.e., the result of S210 is no, it can be understood that the available storage space of the non-secure zone is not enough to “allocate” to the secure zone, the chip system 102 can determine that the storage space adjustment in the secure zone fails, and therefore does not install the installation package 2 of the first security service, and ends the service download process.

[0183] Exemplarily, the chip system 102 is the chip 300 shown in FIG. 15. As shown in FIG. 15, in case 1, the SAU control module in the secure zone of the chip 300 can perform S209-S210 shown in FIG. 14. Among them, the SAU control module in the secure zone can call the available storage space size obtaining module in the non-secure zone to obtain the size of the available storage space of the non-secure zone, i.e., perform S209. When the result of S210 is yes, the SAU control module can perform S211 shown in FIG. 14, and jump to the installation module in the secure zone, and the installation module performs S212 shown in FIG. 14. When the result of S210 is no, the SAU control module can perform S213 shown in FIG. 14, i.e., end the service download process.

[0184] The above embodiments take the example of performing S206-S208 after S205. In some other embodiments, the electronic device 100 can perform S206-S208 before S205. In some examples, the electronic device 100 performs S206-S208 first when receiving a user input of opening the download service of the small program of the first secure service, and then the electronic device 100 can perform S205. The electronic device 100 can select whether to perform S209-S210 in combination with the judgment result of S208 and whether the user enables the smart installation function. Alternatively, the electronic device 100 can prompt the user with the judgment result of S208 and prompt the user to select whether to enable the smart installation function, to facilitate the user to make a selection. For example, the electronic device 100 receives a user input of opening the purchase interface of “B country 1-day traffic”, performs S206-S208 first, and displays the purchase interface of “B country 1-day traffic” according to the judgment result of S208. Take the user interface 1630 shown in FIG. 16C as an example. The display content of the prompt box 1631 in the user interface 1630 shown in FIG. 16C is determined according to the judgment result of S208. FIG. 16C takes the example of the judgment result of S208 being yes, and therefore the prompt information displayed by the prompt box 1631 includes “space limited for secure service”. The user can select whether to enable the smart installation function (e.g., whether to click the enable control 1631A in the user interface 1630) in combination with the prompt information displayed by the prompt box 1631. When the user selects to enable the smart installation function and the judgment result of S208 is yes, the electronic device 100 can perform S209-S213. However, in some other examples, the display content of the prompt box 1631 in the user interface 1630 shown in FIG. 16C can not be determined according to the judgment result of S208. Regardless of the judgment result of S208, “space limited for secure service” can be displayed in the prompt box 1631. The embodiments of the present application do not limit the prompt method of prompting the user to enable the smart installation function.

[0185] The above embodiments take the example of directly ending the service download process when the judgment result of S210 is no. In some other embodiments, when the judgment result of S210 is no, S213 can not be performed, and the chip system 102 in the electronic device 100 can delete data in the secure zone to the non-secure zone, for example, automatic deletion or prompting the user to manually delete, and then perform S210 after deletion. In some other embodiments, when the judgment result of S210 is no, the chip system 102 in the electronic device 100 can delete data in the secure zone, for example, automatic deletion or prompting the user to manually delete, and then perform S207 and S208 after deletion. When the data cannot be deleted and the judgment result of S210 is no, S213 can be performed.

[0186] Not limited to the above-mentioned embodiments, in other embodiments, the chip system 102 in the electronic device 100 can also be in a default open state, and the electronic device 100 can execute the system startup process of the chip system 102 when starting, that is, the system startup process of the chip system 102 is executed before S101 in FIG. 11 / S201 in FIG. 14, and in other embodiments, the electronic device 100 can also automatically execute the system startup process of the chip system 102 when a preset condition is met (for example, in a scenario where the user uses the electronic device 100), and the execution timing of the system startup process of the chip system 102 is not limited in the embodiments of the present application.

[0187] In the above-mentioned embodiments, when judging whether the available storage space of the non-secure zone is sufficient to be “allocated” to the secure zone, it is judged whether (sizeD-sizeE) is less than sizeF, that is, whether (sizeF-(sizeD-sizeE)) is greater than or equal to 0, which can be understood as judging whether the available storage space of the non-secure zone (sizeF) is greater than 0 after “allocating” (sizeD-sizeE) size of storage space in the available storage space of the non-secure zone to the secure zone. Not limited to this, in other embodiments, S210 can also be to judge whether (sizeF-(sizeD-sizeE)) is greater than or equal to a preset threshold, which can be understood as judging whether the available storage space of the non-secure zone is greater than or equal to the preset threshold after “allocating” (sizeD-sizeE) size of storage space in the available storage space of the non-secure zone to the secure zone. In this way, the available storage space can be reserved for the second security service in the non-secure zone, avoiding the use of the second security service being affected, and the user experience is better.

[0188] The following exemplary illustrates how to realize the adjustment of the storage space of the security service through the SAU, for example, the implementation manner of S111 in FIG. 11 and S211 in FIG. 14.

[0189] FIG. 17 is a schematic diagram of a memory of a chip 300 provided in an embodiment of the present application.

[0190] As shown in FIG. 17, the memory of the chip 300 can store a loading operating system (BOOT OS) (for example, an OS for implementing SECURE BOOT), a main function OS (for example, an OS of main_s.c and / or main_ns.c shown in FIG. 10), shared code, a system OS, an OS of a first security service, an OS of a second security service, a common OS, and a flash memory OS.

[0191] As shown in FIG. 17, the memory of the chip 300 can also store post download data of the first secure service and post download data of the second secure service. The post download data of the first / second secure service (may be referred to as post code and / or post data) is data of the secure service downloaded during use of the chip, which can be understood as personalized data of the user. The secure service data (such as the installation package of the secure service applet described above) described in the embodiments of the present application can be post download data.

[0192] FIG. 17 takes the memory of the chip 300 as an example, which is 2.5 Mbytes (M). The address of the memory of the chip 300 is represented in hexadecimal (H), and the address range of the memory of the chip 300 can be 00 0000H to 20 1500H. The first 1M space (address range: 00 0000H to 10 0000H) in the memory of the chip 300 can store the BOOT OS, the main function OS, the shared code, the system OS, and the OS of the first secure service. The 0.5M space (address range: 10 0000H to 10 1500H) after the above-mentioned 1M space can store the OS of the second secure service, the common OS, and the flash memory OS. The 1M space (address range: 10 1500H to 20 1500H) after the above-mentioned 1.5M space can store the post download data of the first secure service and the post download data of the second secure service. A part (supposed size: size1) of the last 1M space (address range: 10 1500H to 20 1500H) stores the post download data of the first secure service, which can be referred to as the storage space of the first secure service, and another part (supposed size: size2) stores the post download data of the second secure service, which can be referred to as the storage space of the second secure service. FIG. 17 takes size1 and size2 as an example, and thus the first size1 (i.e., 0.5M) space (address range: 10 1500H to 18 1500H) in the last 1M space stores the post download data of the first secure service, and the second size2 (i.e., 0.5M) space (address range: 18 1500H to 20 1500H) stores the post download data of the second secure service. The address between the storage space of the first secure service and the storage space of the second secure service can be referred to as the address of the firewall, such as the address 18 1500H in FIG. 17.

[0193] Based on the description of FIG. 7, it can be obtained that the attribute of any one of the storage spaces (which can be referred to as storage space 1) in the memory of the chip 300 shown in FIG. 17 is determined according to the attribute of the storage space 1 mapped in the SAU and the attribute of the storage space 1 mapped in the IDAU, and the following is described by taking the highest priority as an example. The attribute of the storage space 1 mapped in the SAU can be the attribute of the space corresponding to the storage space 1 in the SAU. The attribute of the storage space 1 mapped in the IDAU can be the attribute of the space corresponding to the storage space 1 in the IDAU. In some embodiments, when the addresses of the storage space in the memory and the space in the SAU are the same, it can be said that the two correspond. When the addresses of the storage space in the memory and the space in the IDAU are the same, it can be said that the two correspond.

[0194] As shown in FIG. 17, the first 1M space (address range 00 0000H to 10 0000H) in the memory of the chip 300 corresponds to the space 11 (address range 00 0000H to 10 0000H) in the SAU, and also corresponds to the space 21 (address range 00 0000H to 10 0000H) in the IDAU. Since the attribute of the space 11 in the SAU is secure (i.e., belongs to the secure zone), and the attribute of the space 21 in the IDAU is secure (i.e., belongs to the secure zone), the attribute of the first 1M space (address range 00 0000H to 10 0000H) in the memory of the chip 300 is secure (i.e., belongs to the secure zone).

[0195] Similarly, the 0.5M space (address range 10 0000H to 10 1500H) in the memory of the chip 300 corresponds to the space 12 (address range 10 0000H to 10 1500H) in the SAU, and also corresponds to the space 22 (address range 10 0000H to 10 1500H) in the IDAU. Since the attribute of the space 12 in the SAU is non-secure (i.e., belongs to the non-secure zone), and the attribute of the space 22 in the IDAU is non-secure (i.e., belongs to the non-secure zone), the attribute of the 0.5M space (address range 10 0000H to 10 1500H) in the memory of the chip 300 is non-secure (i.e., belongs to the non-secure zone).

[0196] As shown in FIG. 17, the front size1 (i.e. 0.5M) size of storage space (address range of 101500H to 18 1500H) in the last 1M space (address range of 101500H to 20 1500H) in the memory of the chip 300 corresponds to the space 13 (address range of 101500H to 18 1500H) in the SAU, and also corresponds to the space 23 (address range of 101500H to 18 1500H) in the IDAU. The rear size2 (i.e. 0.5M) size of storage space (address range of 18 1500H to 20 1500H) corresponds to the space 14 (address range of 18 1500H to 20 1500H) in the SAU, and also corresponds to the space 24 (address range of 18 1500H to 20 1500H) in the IDAU. Since the space 23 and the space 24 in the IDAU are not defined with attributes (which can be referred to as belonging to the coexistence zone), the attribute of the last 1M space (address range of 101500H to 20 1500H) in the memory of the chip 300 is the attribute of the position in the SAU corresponding to the last 1M space. Since the attribute of the space 13 in the SAU is secure (i.e. belonging to the secure zone), the attribute of the size1 (i.e. 0.5M) size of storage space (address range of 101500H to 18 1500H) in the memory of the chip 300 is secure (i.e. belonging to the secure zone), which is used to store the post-download data of the first security service deployed in the secure zone, i.e. the size1 size of storage space is the storage space of the first security service. Since the attribute of the space 14 in the SAU is non-secure (i.e. belonging to the non-secure zone), the attribute of the size2 (i.e. 0.5M) size of storage space (address range of 18 1500H to 20 1500H) in the memory of the chip 300 is non-secure (i.e. belonging to the non-secure zone), which is used to store the post-download data of the second security service deployed in the non-secure zone, i.e. the size2 size of storage space is the storage space of the second security service.

[0197] In some embodiments, the SAU can set a region number (RN) for the space in the SAU, i.e., divide the space into RN subspaces, RN can be an integer, for example, 0, 2, 4, 8, etc., where 0 represents no division of subspaces. The SAU can define (including modify) the attributes of any one of the RN subspaces. FIG. 17 illustrates an example in which the SAU sets RN = 8 for space 13 and space 14 together, i.e., sets RN = 8 for the space with an address range of 10 1500H to 20 1500H. Assuming that the RN = 8 subspaces are numbered in order from small to large address, then space 13 and space 14 can include subspaces 1 to 8, where subspaces 1 to 4 belong to space 13 and subspaces 5 to 8 belong to space 14. The size of each subspace is 1 / 8 = 0.125M. The address range of subspace 1 is 10 1500H to 12 1500H, the address range of subspace 2 is 12 1500H to 14 1500H, the address range of subspace 3 is 14 1500H to 16 1500H, the address range of subspace 4 is 16 1500H to 18 1500H, the address range of subspace 5 is 18 1500H to 1A 1500H, the address range of subspace 6 is 1A 1500H to 1C 1500H, the address range of subspace 7 is 1C 1500H to 1E 1500H, and the address range of subspace 8 is 1E 1500H to 20 1500H.

[0198] In the embodiments of the present application, when the user triggers to download data of a certain type of security service, and the storage space of the type of security service is insufficient to download the data, the address of the firewall in the SAU can be adjusted to realize the adjustment of the address of the firewall in the memory of chip 300, so as to redivide the storage space of the security service in the memory of chip 300.

[0199] In some embodiments, when a user triggers to download data of a second secure service in the non-secure zone, and the storage space of the second secure service is insufficient to download the data, for example, when S111 shown in FIG. 11 is executed, the space 14 in the SAU with the attribute of non-secure can be expanded, i.e., the space 14 is increased. Since the total size of the space 13 and the space 14 is unchanged (i.e., 1M), the size of the space 13 with the attribute of secure will be reduced. Based on the above description of the storage space with the size of size1 and the storage space with the size of size2 in the memory of the chip 300, it can be obtained that when the space 14 with the attribute of non-secure in the SAU is increased, the storage space with the attribute of non-secure included in the last 1M space in the memory of the chip 300 (i.e., the storage space of the second secure service with the size of size2) will also be increased, i.e., size2 will be increased. When the space 13 with the attribute of secure in the SAU is reduced, the storage space with the attribute of secure included in the last 1M space in the memory of the chip 300 (i.e., the storage space of the first secure service with the size of size1) will also be reduced, i.e., size1 will be reduced. In S111 of FIG. 11, the storage space of the non-secure region is the storage space with the attribute of non-secure included in the last 1M space in the memory of the chip 300 (i.e., the storage space of the second secure service with the size of size2), and sizeB is less than or equal to size2. The storage space of the non-secure region in S111 of FIG. 11 is mapped to the space 14 in the SAU.

[0200] In some examples, when the space 14 with the attribute of non-secure in the SAU is expanded, the expansion is performed in units of subspaces. That is, the attributes of x subspaces in the space 13 adjacent to the space 14 are modified from secure to non-secure, x being a positive integer. Here, x needs to satisfy the following condition: the size of the available storage space in the space 14 (for example, sizeB in S111 of FIG. 11) is greater than the sum of the sizes of the x subspaces (for example, sizeB' in S111 of FIG. 11), which is greater than the size of the data of the second secure service to be downloaded (for example, the size sizeA of the installation package 1 in S111 of FIG. 11). For example, assuming that x is 2, the attributes of the subspace 4 and the subspace 3 in the space 13 adjacent to the space 14 can be modified from secure to non-secure, and thus the address range of the space 14 becomes 14 1500H to 20 1500H and the address range of the space 13 becomes 10 1500H to 14 1500H. Accordingly, the address range of the storage space in the memory of the chip 300 for storing the post-download data of the second secure service (with the attribute of non-secure, that is, the storage space of the second secure service) becomes 14 1500H to 20 1500H, and the size size2 of the storage space of the second secure service becomes 0.75M. The address range of the storage space in the memory of the chip 300 for storing the post-download data of the first secure service (with the attribute of secure, that is, the storage space of the first secure service) becomes 10 1500H to 14 1500H, and the size size1 of the storage space of the first secure service becomes 0.25M.

[0201] In some embodiments, when a user triggers to download data of a first secure service in the secure zone, and the storage space of the first secure service is not enough to download the data, for example, when S211 shown in FIG. 14 is executed, the space 13 in the SAU with the attribute of secure can be expanded, i.e., the space 13 is increased. Since the total size of the space 13 and the space 14 is unchanged (i.e., 1M), the size of the space 14 with the attribute of non-secure will be reduced. Based on the above description of the storage space with the size of size1 and the storage space with the size of size2 in the memory of the chip 300, it can be obtained that when the space 13 with the attribute of secure in the SAU is increased, the storage space with the attribute of secure (i.e., the storage space of the first secure service, with the size of size1) included in the last 1M space in the memory of the chip 300 will also be increased, i.e., size1 will be increased. When the space 14 with the attribute of non-secure in the SAU is reduced, the storage space with the attribute of non-secure (i.e., the storage space of the second secure service, with the size of size2) included in the last 1M space in the memory of the chip 300 will also be reduced, i.e., size2 will be reduced. In S211 of FIG. 14, the storage space of the secure region is the storage space with the attribute of secure (i.e., the storage space of the first secure service, with the size of size1) included in the last 1M space in the memory of the chip 300, and sizeE is less than or equal to size1. The storage space of the secure region in S211 of FIG. 14 is mapped to the space 13 in the SAU.

[0202] In some examples, when expanding the space 13 in the SAU with the attribute of secure, the expansion is performed in units of subspaces. That is, the attribute of y subspaces in the space 13 that are close to the space 14 is modified from non-secure to secure, y being a positive integer. Here, y needs to satisfy the following condition: the size of the available storage space in the space 13 (for example, sizeE in S211 of FIG. 14) is greater than the sum of the sizes of the y subspaces (for example, sizeE' in S211 of FIG. 14) and the size of the data of the second secure service to be downloaded (for example, the size sizeD of the installation package 2 in S211 of FIG. 14). For example, assuming that y is 1, the attribute of the subspace 5 in the space 14 that is close to the space 13 can be modified from non-secure to secure, and thus the address range of the space 13 becomes 10 1500H to 1A 1500H, and the address range of the space 14 becomes 1A 1500H to 20 1500H. Correspondingly, the address range of the storage space in the memory of the chip 300 for storing the post-download data of the first secure service (with the attribute of secure, that is, the storage space of the first secure service) becomes 10 1500H to 1A 1500H, and the size size1 of the storage space of the first secure service becomes 0.625M. The address range of the storage space in the memory of the chip 300 for storing the post-download data of the second secure service (with the attribute of non-secure, that is, the storage space of the second secure service) becomes 1A 1500H to 20 1500H, and the size size2 of the storage space of the second secure service becomes 0.375M.

[0203] The above examples take the adjustment of the storage space of the secure service performed in the secure zone as an example for illustration, and in some other examples, the adjustment of the storage space of the secure service can also be performed in the non-secure zone, which is not limited in the embodiments of the present application.

[0204] Next, the implementation of the system startup process of the chip 300, for example, S102-S104 of FIG. 11 and S202-S204 of FIG. 14, is exemplarily described.

[0205] FIG. 18 is a structural schematic diagram of another chip 300 provided by the embodiments of the present application.

[0206] As shown in FIG. 18, the secure zone of the chip 300 can include a power on module, a secure boot module, a trustzone initialization module, a self-check module, a task delegation module, a secure zone resource initialization module, a secure zone service initialization module, a non-secure zone resource initialization module, and a secure zone program. The non-secure zone of the chip 300 can include a non-secure zone startup module, a non-secure zone service initialization module, and a non-secure zone program. The system startup flow of the chip 300 can include:

[0207] 1. The power on module performs power on.

[0208] 2. The secure boot module performs secure boot.

[0209] 3. The trustzone initialization module performs trustzone initialization (also referred to as initialization of trustzone subsystems, or initialization of trustzone architecture), for example, but not limited to, including: initializing a stack, setting PSP_S and / or PSPLIM_S, setting MSP_S and / or MSPLIM_S, setting an interrupt vector of the secure zone, setting an interrupt vector of the non-secure zone, partitioning and setting of the SAU.

[0210] 4. The self-check module performs system check, for example, entering a test mode and / or a factory OS, and when the check result is normal, performing the subsequent flow (for example, performing step 5 below).

[0211] 5. The task delegation module performs task delegation, for example, entering a mission mode and / or a main OS. The task delegation module can first perform task delegation of the secure zone (for example, delegating tasks to the secure zone resource initialization module), and then perform task delegation of the non-secure zone (for example, delegating tasks to the non-secure zone startup module).

[0212] 6. The secure zone resource initialization module can perform resource initialization of the secure zone, for example, but not limited to, including: starting one or more threads of the first secure service, and performing resource allocation and implementing related interrupt vectors (such as storage / cache interrupt vectors). For example, the secure zone resource initialization is performed after entering the secure zone main function module. Before the secure zone main function module performs the secure zone resource initialization, the following operations can be performed: setting PSP NS and / or PSPLIM NS, setting MSP NS and / or MSPLIM NS.

[0213] 7. The secure zone service initialization module can perform service initialization of the secure zone, and after the service initialization is completed, the first secure service can be executed. For example, the first secure service is an eSIM service, and after the service initialization of the secure zone is completed, the eSIM profile can be used to perform network camping. In some examples, when the secure zone service initialization module performs the service initialization of the secure zone, interrupts sent by a non-secure program of the non-secure zone can be received, and / or the non-secure program (for example, the non-secure call function in FIG. 8) of the non-secure zone can be called.

[0214] 8. The non-secure zone resource initialization module can perform resource initialization of the non-secure zone, for example, but not limited to, including: starting one or more threads of the second secure service, and performing resource allocation and implementing related interrupt vectors (such as storage / cache interrupt vectors).

[0215] 9. The non-secure zone start module can perform start up of the non-secure zone.

[0216] 10. The non-secure zone service initialization module can perform the service initialization of the non-secure zone, and after the service initialization is completed, the second secure service can be executed. For example, the second secure service is an NFC service, and after the service initialization of the non-secure zone is completed, NFC can be used for communication (for example, the card swiping service of the NFC simulation card is performed). In some examples, when the non-secure zone service initialization module performs the service initialization of the non-secure zone, the secure program (for example, the non-secure entry function in FIG. 8) of the secure zone can be called, and after the execution of the secure program of the secure zone is completed, the non-secure zone is returned (for example, the callback function in the non-secure zone is returned). Not limited to this, when the non-secure zone service initialization module performs the service initialization of the non-secure zone, the interrupts sent by the secure program of the secure zone can also be received.

[0217] In the system startup process of the chip 300, the resource initialization and the service initialization of the secure zone and the resource initialization of the non-secure zone are first implemented in the secure zone, and then the service initialization of the non-secure zone is implemented in the non-secure zone, that is, the resource initialization of the two regions is first completed in the secure zone with higher priority, to prepare for subsequent service initialization and service use, so as to avoid that the resource initialization of the non-secure zone cannot be effectively completed in the non-secure zone with lower priority, the use of the second secure service is affected, and the user experience is ensured.

[0218] Not limited to the above-mentioned embodiments, in another embodiment, the resource initialization and the service initialization of the non-secure zone can also be performed in the non-secure zone, for example, in the case that the priorities of the secure zone and the non-secure zone are the same, in another embodiment, the resource initialization and the service initialization of the secure zone and the resource initialization and the service initialization of the non-secure zone can also be simultaneously implemented in the secure zone and the non-secure zone, respectively, and the system startup process of the chip 300 is not limited in the embodiment of the present application.

[0219] It can be understood that the chip system 102 / chip 300 illustrated in the embodiments of the present application is only an example, and the chip system 102 / chip 300 can have more or fewer components than illustrated, can combine two or more components, or can have a different component configuration. The various components illustrated can be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.

[0220] FIG. 19 is a flow diagram of another storage space adjustment method provided by the embodiments of the present application. The method shown in FIG. 19 can be applied to an electronic device including a first chip. The electronic device can be the electronic device 100 shown in FIG. 1, the first chip can be the chip system 102 in the electronic device 100 shown in FIG. 1, and the first chip can be the chip 300 shown in at least one of FIGS. 3-8. The method shown in FIG. 19 can include, but is not limited to, the following steps:

[0221] S301: The electronic device receives a first input of downloading first data of a first service.

[0222] S302: When the size of the first data is less than the size of the unused space in the first storage space, the electronic device stores the first data in the first storage space and displays first prompt information (for prompting that the first data has been downloaded).

[0223] For example, the first chip stores the first data in the first storage space, and the electronic device displays the first prompt information.

[0224] S303: When the size of the first data is greater than or equal to the size of the unused space in the first storage space, the electronic device increases the first storage space, stores the first data in the increased first storage space, and displays the first prompt information (for prompting that the first data has been downloaded).

[0225] For example, the first chip increases the first storage space and stores the first data in the increased first storage space, and the electronic device displays the first prompt information.

[0226] The first chip includes a first storage space and a second storage space, the first storage space is used to store download data of a first service, the second storage space is used to store download data of a second service, and the sum of the sizes of the first storage space and the second storage space is a fixed first value. Therefore, when the first storage space is increased, the second storage space is decreased, and the value of the increase of the first storage space is equal to the value of the decrease of the second storage space. Similarly, when the second storage space is increased, the first storage space is decreased, and the value of the increase of the second storage space is equal to the value of the decrease of the first storage space.

[0227] In S303, the electronic device can increase the first storage space by a second value, and the size of the unused space in the increased first storage space is greater than the size of the first data, so that the first data can be stored in the increased first storage space. Wherein, when the first storage space is increased by the second value, the second storage space is reduced by the second value.

[0228] In some embodiments, the first chip is a chip of Trustzone architecture, the first chip includes a first region and a second region, the first region is used to deploy and run the first service, and the second region is used to deploy and run the second service, the storage space of the first region includes the first storage space, and the storage space of the second region includes the second storage space. Wherein, the first region and the second region have independent working permissions, and the first region and the second region have independent working modes. For example, the working permissions of the first region include first user permissions and first privileged permissions, the working permissions of the second region include second user permissions and second privileged permissions, the working mode of the first region includes a first thread mode and a first handler mode, and the working mode of the second region includes a second thread mode and a second handler mode. The first chip can be the chip 300 shown in at least one of FIGS. 3-8. The above-mentioned example of the deployment process of the first chip can refer to FIGS. 9 and 10.

[0229] In some embodiments, in S303, the first chip can increase the first storage space in the secure zone, and then store the first data in the increased first storage space in the first region. Wherein, the first region is the secure zone, and at this time, the implementation example of FIG. 19 can refer to FIG. 14. Alternatively, the first region is the non-secure zone, and at this time, the implementation example of FIG. 19 can refer to FIG. 11.

[0230] In some embodiments, the first region is the non-secure zone, the second region is the secure zone, the first service is the second secure service deployed in the non-secure zone, the second service is the first secure service deployed in the secure zone, the first storage space is the storage space of the second secure service, and the second storage space is the storage space of the first secure service. In this case, the implementation example of FIG. 19 can refer to the service download process (S105-S113) shown in FIG. 11. In this case, S301 of FIG. 19 can be S105 of FIG. 11, S302 of FIG. 19 can be S112 executed when the result of S108 of FIG. 11 is no, and S303 of FIG. 19 can be S109-S112 executed when the result of S108 of FIG. 11 is yes. The first data of the first service shown in FIG. 19 can be the installation package 1 (with a size of sizeA) of the applet of the second secure service shown in FIG. 11, the unused space in the first storage space shown in FIG. 19 can be the available storage space (with a size of sizeB) of the non-secure zone shown in FIG. 11, and the unused space in the first storage space after the increase shown in FIG. 19 can be the available storage space (with a size of sizeB') of the non-secure zone after the expansion shown in FIG. 11. Optionally, a system startup process of the first chip can be performed before S301, and an implementation example can refer to the system startup process (S101-S103) shown in FIG. 11.

[0231] In some embodiments, the first region is the secure zone, the second region is the non-secure zone, the first service is the first secure service deployed in the secure zone, the second service is the second secure service deployed in the non-secure zone, the first storage space is the storage space of the first secure service, and the second storage space is the storage space of the second secure service. In this case, the implementation example of S301 in FIG. 19 can refer to the service download process (S205-S213) shown in FIG. 14. In this case, S301 in FIG. 19 can be S205 in FIG. 14, S302 in FIG. 19 can be S212 executed when the result of S208 in FIG. 14 is no, and S303 in FIG. 19 can be S209-S212 executed when the result of S208 in FIG. 14 is yes. The first data of the first service shown in FIG. 19 can be the installation package 2 (size is sizeD) of the applet of the first secure service shown in FIG. 14, the unused space in the first storage space shown in FIG. 19 can be the available storage space (size is sizeE) of the secure zone shown in FIG. 14, and the unused space in the first storage space after the increase shown in FIG. 19 can be the available storage space (size is sizeE') of the secure zone after the expansion shown in FIG. 14. Optionally, S301 can be followed by a system startup process of the first chip, and an implementation example can refer to the system startup process (S201-S203) shown in FIG. 14.

[0232] In some embodiments, when the first storage space is increased in S303, it can be determined whether the difference between the size of the unused space in the second storage space and a third value is greater than or equal to a preset threshold (e.g., the preset threshold is greater than or equal to 0), and the third value is the difference between the size of the first data and the size of the unused space in the first storage space. When the difference between the size of the unused space in the second storage space and the third value is greater than or equal to the preset threshold, the first storage space is increased by a fourth value (the fourth value is greater than or equal to the third value), otherwise the first storage space is not increased. An implementation example can refer to S110 in FIG. 11 or S210 in FIG. 14.

[0233] In some embodiments, the increase of the first storage space in S303 can be performed when the smart installation function is enabled, and an implementation example can refer to the following four cases, but should not be construed as a limitation.

[0234] In the case one, after S301, when the size of the first data is greater than or equal to the size of the unused space in the first storage space, the electronic device can first display the first prompt information (for prompting the user to turn on the smart installation function), for example, the first service is the NFC service, after the electronic device receives the user operation on the control 1311 in the user interface 1310 shown in FIG. 13A (i.e., S301), when the size of the first data is greater than or equal to the size of the unused space in the first storage space, the electronic device can display the user interface 1320 shown in FIG. 13B, and the first prompt information can be the prompt information included in the prompt box 1321 in the user interface 1320, that is, the prompt information “Smart Installation: The space of the secure chip is limited, and the space adjustment is being performed”. Then, the electronic device receives a second input for turning on the smart installation function, and in the case of receiving the second input (i.e., in the case that the smart installation function has been turned on by the user), the electronic device further increases the first storage space, for example, after the electronic device receives the user operation on the control 1321A in the user interface 1320 shown in FIG. 13B (i.e., receives the second input), the first storage space is increased. Not limited to the above example, in other examples, the first data is the data of the eSIM service, and FIGS. 13A and 13B can be replaced by FIGS. 16A and 16B, and the embodiments of the present application do not limit the first prompt information and the received input.

[0235] In the case two, before S301, the electronic device can display the second prompt information (for prompting the user to turn on the smart installation function) and receive a third input for turning on the smart installation function. After S301, because the third input for turning on the smart installation function has been received before (i.e., the smart installation function has been turned on by the user), the electronic device can increase the first storage space. For example, the first service is the NFC service, and the electronic device can display the user interface 1330 shown in FIG. 13C, and the second prompt information can be the prompt information included in the prompt box 1331 in the user interface 1330, that is, the prompt information “The space of the secure chip is limited, and the smart installation (authorized firewall management, adaptive space size) can be turned on”. The electronic device can receive the user operation on the turning-on control 1331A in the user interface 1330 shown in FIG. 13C (i.e., receive the third input). Then, the electronic device can receive the user operation on the control 1311 in the user interface 1330 shown in FIG. 13C (i.e., receive the first input), and increase the first storage space based on the first input and the third input. Not limited to the above example, in other examples, the first data is the data of the eSIM service, and FIG. 13C can be replaced by FIG. 16C, and the embodiments of the present application do not limit the second prompt information and the received input.

[0236] In some examples, the electronic device can display the second prompt information when displaying a relevant interface of the first data (e.g., a download interface of the first data), and determine whether the size of the first data is greater than or equal to the size of the unused space in the first storage space. When the result of the determination is yes, the electronic device displays the second prompt information according to the result of the determination. In other examples, the electronic device can also not determine and directly display the second prompt information. The electronic device determines whether the size of the first data is greater than or equal to the size of the unused space in the first storage space after receiving the first input of downloading the first data.

[0237] In case three, the electronic device can start the smart installation function by default. In S303, when the size of the first data is greater than or equal to the size of the unused space in the first storage space, the first storage space can be directly increased because the smart installation function is started.

[0238] In case four, before S301, the electronic device can receive a user input acting on a setting interface and start the smart installation function in response to the user input. In S303, when the size of the first data is greater than or equal to the size of the unused space in the first storage space, the first storage space can be directly increased because the smart installation function is started.

[0239] In some embodiments, the first chip includes a SAU and an IDAU. For specific examples, refer to the chip 300 shown in FIG. 4. The SAU is a unit that can be dynamically programmed at runtime, and the IDAU is a custom unit with programming restrictions. For specific descriptions, refer to the descriptions of the SAU and the IDAU in FIGS. 3-8 above. The storage space in the first chip is determined by the corresponding space in the SAU and the corresponding space in the IDAU. For example, the SAU includes a first space and a second space, and the sum of the sizes of the first space and the second space is the first value described above. The first space corresponds to the first storage space (e.g., the same address), and the second space corresponds to the second storage space (e.g., the same address). The IDAU includes a third space and a fourth space, and the sum of the sizes of the third space and the fourth space is the first value described above. The third space corresponds to the first storage space (e.g., the same address), and the fourth space corresponds to the second storage space (e.g., the same address). The first storage space is determined according to the first space in the SAU and the third space in the IDAU. The second storage space is determined according to the second space in the SAU and the fourth space in the IDAU. Therefore, when the first storage space is increased in S303, the size of the first space in the SAU can be increased by the second value, and the first storage space increased by the second value can be obtained according to the first space increased by the second value in the SAU and the third space in the IDAU. When the first space is increased by the second value, the second space is decreased by the second value.

[0240] In some embodiments, the attribute of the storage space in the first chip is determined jointly by the attribute of the corresponding space in the SAU and the attribute of the corresponding space in the IDAU. For example, refer to FIG. 7. For example, the attribute of the first storage space is the attribute with higher priority between the attribute of the first space and the attribute of the third space, and the attribute of the second storage space is the attribute with higher priority between the attribute of the second space and the attribute of the fourth space. The first space has a first attribute corresponding to the first region, and the attribute of the third space is lower than or equal to the first attribute. Therefore, the first storage space has the first attribute corresponding to the first region, i.e., the first storage space belongs to the storage space of the first region. The second space has a second attribute corresponding to the second region, and the attribute of the fourth space is lower than or equal to the second attribute. Therefore, the second storage space has the second attribute corresponding to the second region, i.e., the second storage space belongs to the storage space of the second region. Therefore, when the size of the first space in the SAU is increased by the second value in S303, the attribute of the fifth space with the size of the second value in the second space can be modified from the second attribute to the first attribute, and the first space and the fifth space are determined as the first space with the increased second value. It can be understood that the fifth space in the second space is "divided" to the first space to increase the first space. When the first storage space with the increased second value is obtained according to the first space with the increased second value in the SAU and the third space in the IDAU in S303, the first attribute of the first storage space with the increased second value can be determined according to the first attribute of the first space with the increased second value in the SAU and the attribute of the sixth space in the IDAU, wherein the sixth space includes the seventh space with the size of the second value in the third space and the fourth space, the fifth space and the seventh space correspond to each other (e.g., the same address), the first storage space with the increased second value includes the third storage space with the size of the second value in the first storage space and the second storage space, and the fifth space and the seventh space correspond to the third storage space (e.g., the same address). Since the attributes of the third space and the fourth space (including the seventh space) are lower than or equal to the first attribute, the attribute of the sixth space is lower than or equal to the first attribute. Therefore, the attribute of the first storage space with the increased second value determined according to the first attribute of the first space with the increased second value and the attribute of the sixth space is the first attribute.

[0241] Examples of the first storage space, the second storage space, the space in the SAU and the space in the IDAU can be found in FIG. 17. The following is described by taking the first region as the secure zone, the second region as the non-secure zone, the first service as the first secure service and the second service as the second secure service. The first storage space is the storage space of the first secure service shown in FIG. 17 (with a size of size1 and used for storing the post-download data of the first secure service), the first space in the SAU corresponding to the first storage space is space 13 shown in FIG. 17, and the third space in the IDAU corresponding to the first storage space is space 23 shown in FIG. 17. The second storage space is the storage space of the second secure service shown in FIG. 17 (with a size of size2 and used for storing the post-download data of the second secure service), the second space in the SAU corresponding to the second storage space is space 14 shown in FIG. 17, and the fourth space in the IDAU corresponding to the second storage space is space 24 shown in FIG. 17. The first attribute corresponding to the first region is secure, and the second attribute corresponding to the second region is non-secure. An example of implementing S303 can be found in the description of re-partitioning the storage space of the secure service in the memory of the chip 300 shown in FIG. 17.

[0242] In some embodiments, the first chip is a chip of the Trustzone architecture. Before S301, a system startup procedure of the first chip can be performed: the first chip is powered on and loaded, the initialization of the Trustzone architecture of the first chip is performed, the resource initialization of the secure zone and the service initialization of the secure zone are performed in the secure zone of the first chip, the resource initialization of the non-secure zone is performed in the secure zone of the first chip, and the service initialization of the non-secure zone is performed in the non-secure zone of the first chip. The specific implementation procedure can be found in FIG. 18.

[0243] For example, the first service is an NFC service, and the second service is an eSIM service. Alternatively, the first service is an eSIM service, and the second service is an NFC service.

[0244] Without being limited to the example shown in FIG. 19, in another example, the first prompt information can not be displayed when the electronic device successfully stores the first data, and in another example, the first prompt information can not be used to prompt that the first data has been downloaded.

[0245] The above embodiments are described by taking the expansion of the storage space of the non-secure zone / secure zone implemented through the SAU as an example, but should not be construed as a limitation, and other programmable units can also be used.

[0246] The above embodiments take the Trustzone technology as an example to divide the chip into two regions, and in some other embodiments, the Trustzone technology can also divide the chip into three or more regions, and different regions can deploy different security services.

[0247] The above embodiments take the Trustzone technology as an example, and other technologies / architectures that can divide the chip into multiple regions can also be used, which are not limited in the embodiments of the present application.

[0248] FIG. 20 is a schematic diagram of a hardware structure of another electronic device 100 according to an embodiment of the present application.

[0249] As shown in FIG. 20, the electronic device 100 can include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headset interface 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and an eSIM module 195, etc. The sensor module 180 can include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0250] The processor 110 can include one or more processing units, for example: the processor 110 can include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units can be independent devices, or can be integrated in one or more processors.

[0251] The controller can generate operation control signals according to the instruction operation code and the timing signal, and complete the control of fetching and executing instructions.

[0252] The processor 110 can also be provided with a memory for storing instructions and data. In an embodiment, the memory in the processor 110 is a cache memory. The memory can store instructions or data that have just been used or are being recycled by the processor 110. If the processor 110 needs to use the instructions or data again, it can be directly called from the memory. This avoids repeated access and reduces the waiting time of the processor 110, thereby improving the efficiency of the system.

[0253] In an embodiment, the processor 110 can include one or more interfaces. The interfaces can include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a SIM interface, and / or a universal serial bus (USB) interface, etc.

[0254] The charging management module 140 is configured to receive charging input from a charger. The charger can be a wireless charger or a wired charger. In some embodiments of wired charging, the charging management module 140 can receive charging input from a wired charger through the USB interface 130. In some embodiments of wireless charging, the charging management module 140 can receive wireless charging input through a wireless charging coil of the electronic device 100. The charging management module 140 can charge the battery 142 while also supplying power to the electronic device 100 through the power management module 141.

[0255] The power management module 141 is configured to connect the battery 142 and the charging management module 140 to the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, the internal memory 121, the display 194, the camera 193, the wireless communication module 160, and the like. The power management module 141 can also be configured to monitor parameters such as battery capacity, battery cycle count, battery health (leakage, impedance), and the like. In another embodiment, the power management module 141 can also be disposed in the processor 110. In another embodiment, the power management module 141 and the charging management module 140 can also be disposed in the same device.

[0256] The wireless communication function of the electronic device 100 can be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor, and the like.

[0257] The antenna 1 and the antenna 2 are configured to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 can be configured to cover a single or multiple communication frequency bands. When an antenna covers multiple communication frequency bands for different communication modes, the antenna can be referred to as a mutual antenna, and the mutual antenna can be described with reference to the above-described mutual antenna cases 1, 2, and 3. Different antennas can also be multiplexed to improve the utilization rate of the antennas. For example, the antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In another embodiment, the antenna can be used in combination with a tuning switch.

[0258] The mobile communication module 150 can provide a solution for wireless communication including second generation (2G) / third generation (3G) / fourth-generation (4G) / fifth generation (5G) / sixth generation (6G) or the like applied to the electronic device 100. The mobile communication module 150 can include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), or the like. The mobile communication module 150 can receive an electromagnetic wave by the antenna 1, and perform filtering, amplification, or the like on the received electromagnetic wave, and transfer the same to a modem processor for demodulation. The mobile communication module 150 can also amplify a signal modulated by the modem processor, and radiate the same as an electromagnetic wave through the antenna 1. In an embodiment, at least part of the function modules of the mobile communication module 150 can be disposed in the processor 110. In an embodiment, at least part of the function modules of the mobile communication module 150 can be disposed in the same device as at least part of the modules of the processor 110.

[0259] The modem can include a modulator and a demodulator. The modulator can modulate a low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator can demodulate a received electromagnetic wave signal into a low-frequency baseband signal. The demodulator can then transfer the demodulated low-frequency baseband signal to the baseband processor for processing. The low-frequency baseband signal processed by the baseband processor can be transferred to the application processor. The application processor can output a sound signal through an audio device (not limited to the speaker 170A, the microphone 170B, or the like), or display an image or a video through the display 194. In an embodiment, the modem can be a separate device. In another embodiment, the modem can be disposed in the same device as the mobile communication module 150 or other function modules independently of the processor 110.

[0260] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), and SparkLink Alliance-standard wireless communication technologies (such as SLE and SLB). The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2. In some embodiments, at least one communication module of the wireless communication module 160 of the electronic device 100 can be a separate device; for example, the NFC communication module can be a separate device.

[0261] In one embodiment, the antenna 1 and the mobile communication module 150 of the electronic device 100 are coupled, and the antenna 2 and the wireless communication module 160 are coupled, so that the electronic device 100 can communicate with a network and other devices through wireless communication technology. The wireless communication technology can include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. The GNSS can include global positioning system (GPS), global navigation satellite system (GLONASS), beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS), and / or satellite based augmentation systems (SBAS).

[0262] The electronic device 100 implements a display function through a GPU, a display screen 194, and an application processor, etc. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 can include one or more GPUs that execute program instructions to generate or change display information. The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can adopt a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flex light-emitting diode (FLED), a Miniled, a MicroLed, a Micro-oLed, a quantum dot light emitting diode (QLED), etc. In an embodiment, the electronic device 100 can include N display screens 194, N being a positive integer greater than 1.

[0263] The electronic device 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor, etc. The ISP is used to process data fed back by the camera 193. For example, when taking a photo, the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electric signal, and the camera photosensitive element transmits the electric signal to the ISP for processing to convert it into an image visible to the naked eye. The ISP can also optimize algorithms for image noise, brightness, etc. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In an embodiment, the ISP can be arranged in the camera 193.

[0264] The camera 193 is used to capture still images or videos. An object projects an optical image through a lens to a photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal to an electrical signal, which is then passed to an ISP to convert to a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal to a standard image signal in RGB, YUV, or the like. In an embodiment, the electronic device 100 can include one or N cameras 193, where N is a positive integer greater than one.

[0265] The digital signal processor is used to process digital signals, in addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy, etc. The video codec is used to compress or decompress digital videos. The electronic device 100 can support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple encoding formats, such as moving picture experts group (MPEG) 1, MPEG 2, MPEG 3, MPEG 4, etc. The NPU is a neural-network (NN) computing processor, which is inspired by the structure of biological neural networks, such as the transmission mode between human brain neurons, to quickly process input information, and can also constantly self-learn. Through the NPU, the electronic device 100 can implement intelligent cognitive applications, such as image recognition, face recognition, speech recognition, text understanding, etc.

[0266] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to extend the memory capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to perform a data storage function. For example, files such as music, videos, and the like are stored in the external memory card. The internal memory 121 can be used to store computer executable program code, including instructions. The internal memory 121 can include a program storage area and a data storage area. The program storage area can store an operating system, at least one application program required for a function (such as a sound play function, an image play function, and the like), and the like. The data storage area can store data created during use of the electronic device 100 (such as audio data, a phonebook, and the like), and the like. In addition, the internal memory 121 can include a high-speed random access memory, and can further include a non-volatile memory such as at least one of a disk storage device, a flash memory device, a universal flash storage (UFS), and the like. The processor 110 performs various function applications and data processing of the electronic device 100 by executing instructions stored in the internal memory 121 and / or instructions stored in a memory disposed in the processor.

[0267] The electronic device 100 can implement an audio function through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headset interface 170D, and an application processor, etc. The electronic device 100 can also implement an audio function through a connected Bluetooth device. For example, music play, recording, etc. The audio module 170 is used to convert digital audio information into an analog audio signal output, and also used to convert an analog audio input into a digital audio signal. The audio module 170 can also be used to encode and decode an audio signal. In an embodiment, the audio module 170 can be disposed in the processor 110, or part of the function modules of the audio module 170 can be disposed in the processor 110. The speaker 170A, also called "loudspeaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A. The receiver 170B, also called "earpiece", is used to convert an audio electrical signal into a sound signal. When the electronic device 100 answers a call or a voice message, the receiver 170B can be held close to a human ear to listen to the voice. The microphone 170C, also called "microphone", "sound transducer", is used to convert a sound signal into an electrical signal. When making a call or sending a voice message, a user can speak into the microphone 170C close to the human mouth to input a sound signal into the microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In another embodiment, the electronic device 100 can be provided with two microphones 170C, in addition to collecting a sound signal, it can also implement a noise reduction function. In another embodiment, the electronic device 100 can also be provided with three, four or more microphones 170C, in addition to collecting a sound signal, noise reduction, it can also identify the source of the sound, implement a directional recording function, etc.

[0268] The pressure sensor 180A is configured to sense a pressure signal and convert the pressure signal into an electrical signal. In an embodiment, the pressure sensor 180A can be disposed on the display screen 194. The pressure sensor 180A can be of various types, such as a resistive pressure sensor, an inductive pressure sensor, a capacitive pressure sensor, etc. The capacitive pressure sensor can include at least two parallel plates of conductive material. When a force is applied to the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation is applied to the display screen 194, the electronic device 100 detects the intensity of the touch operation based on the pressure sensor 180A. The electronic device 100 can also calculate the location of the touch based on the detection signal of the pressure sensor 180A. In an embodiment, touch operations applied to the same touch location but with different touch operation intensities can correspond to different operation instructions. For example, when a touch operation with an intensity less than a first pressure threshold is applied to a short message application icon, an instruction to view a short message is executed. When a touch operation with an intensity greater than or equal to the first pressure threshold is applied to the short message application icon, an instruction to create a new short message is executed.

[0269] The gyroscope sensor 180B can be configured to determine the motion posture of the electronic device 100. The barometric sensor 180C is configured to measure air pressure. The magnetic sensor 180D includes a Hall sensor. The acceleration sensor 180E can detect the magnitude of acceleration of the electronic device 100 in various directions (typically three axes). The distance sensor 180F is configured to measure distance. The proximity light sensor 180G can include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode can be an infrared light emitting diode. The ambient light sensor 180L is configured to sense ambient light brightness. The fingerprint sensor 180H is configured to acquire a fingerprint. The electronic device 100 can use the acquired fingerprint characteristics to implement fingerprint unlocking, access application locking, fingerprint photographing, fingerprint answering a call, etc. The temperature sensor 180J is configured to detect temperature. The bone conduction sensor 180M can acquire a vibration signal.

[0270] The touch sensor 180K, also referred to as a "touch device". The touch sensor 180K can be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 together form a touch screen, also referred to as a "touch screen". The touch sensor 180K is configured to detect a touch operation applied thereto or in the vicinity thereof. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In another embodiment, the touch sensor 180K can also be disposed on the surface of the electronic device 100, which is different from the location of the display screen 194.

[0271] The keys 190 include a power on key, a volume key, and the like. The keys 190 can be mechanical keys. They can also be touch keys. The electronic device 100 can receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100. The motor 191 can generate a vibration prompt. The indicator 192 can be an indicator light that can be used to indicate a charging state, a power change, and can also be used to indicate a message, a missed call, a notification, and the like.

[0272] The eSIM module 195 can be embedded in the electronic device 100. The eSIM module 195 is embedded, for example, inside a mainboard of the electronic device 100, and it can replace a physical SIM card, but the size of the eSIM module 195 is generally much smaller. Unlike a physical SIM card, the eSIM module 195 can arbitrarily switch numbers or change operators because information on the eSIM module 195 is rewritable. The eSIM module 195 can be remotely configured by OTA card writing, and profile downloading, activation, deactivation, and deletion can be achieved.

[0273] In some embodiments, any one of the communication modules of the wireless communication module 160 of the electronic device 100 and the eSIM module 195 can be integrated on one chip (such as the chip system 102 / chip 300 shown in the above embodiments), for example, the NFC communication module and the eSIM module 195 are integrated on one chip. Not limited to this, in other embodiments, multiple communication modules of the wireless communication module 160 can be integrated with the eSIM module 195 on one chip, and the embodiments of the present application are not limited in this regard.

[0274] The method provided by the embodiments of the present application can be implemented by software, hardware, firmware or any combination thereof, in whole or in part. When implemented by software, the method can be implemented in the form of a computer program product, in whole or in part. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user equipment or other programmable apparatus. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through a wired (such as coaxial cable, optical fiber, digital subscriber line (DSL) or wireless (such as infrared, wireless, microwave, etc.)) manner. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. integrated with one or more available media sets. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a digital video disc (DWD)), or a semiconductor medium (such as a solid state disk (SSD), etc.). The above-described embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements to some technical features thereof; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for adjusting storage space, applied to an electronic device including a first chip, characterized in that, The first chip includes a first storage space and a second storage space, the first storage space is used for storing download data of a first service, the second storage space is used for storing download data of a second service, a sum of sizes of the first storage space and the second storage space is a first value, and the method includes the following steps: receiving a first input of downloading first data of the first service; when a size of the first data is less than a size of an unused space in the first storage space, storing the first data in the first storage space and displaying first prompt information, the first prompt information being used for prompting that the first data has been downloaded; when the size of the first data is greater than or equal to the size of the unused space in the first storage space, increasing the first storage space, storing the first data in the increased first storage space, and displaying the first prompt information; wherein a size of an unused space in the increased first storage space is greater than the size of the first data, and the second storage space is decreased when the first storage space is increased.

2. The method of claim 1, wherein, The first chip further includes a security attribute unit (SAU) and an implementation definition attribute unit (IDAU), the SAU includes a first space and a second space, a sum of sizes of the first space and the second space is the first value, the IDAU includes a third space and a fourth space, a sum of sizes of the third space and the fourth space is the first value, the first space and the third space both correspond to the first storage space, the second space and the fourth space both correspond to the second storage space, the first storage space is determined according to the first space and the third space, and the second storage space is determined according to the second space and the fourth space; the increasing the first storage space includes the following steps: increasing a size of the first space in the SAU by a second value, and obtaining the first storage space after the second value is increased according to the first space after the second value is increased and the third space; wherein the second space is decreased by the second value when the first space is increased by the second value, the second storage space is decreased by the second value when the first storage space is increased by the second value.

3. The method of claim 2, wherein, An attribute of the first storage space is an attribute with a higher priority between an attribute of the first space and an attribute of the third space, an attribute of the second storage space is an attribute with a higher priority between an attribute of the second space and an attribute of the fourth space, the first space is a first attribute, the second space is a second attribute, the attribute of the third space and the attribute of the fourth space have a priority lower than or equal to a priority of the first attribute, the attribute of the third space and the attribute of the fourth space have a priority lower than or equal to a priority of the second attribute, the first storage space is the first attribute, and the second storage space is the second attribute. The increasing the size of the first space in the SAU by the second value comprises: modifying an attribute of a fifth space of the second value in the second space from the second attribute to the first attribute, and determining the first space and the fifth space as the first space of the second value increased; determining the first attribute of the first storage space of the second value increased according to the first attribute of the first space of the second value increased and an attribute of a sixth space in the IDAU, wherein the sixth space comprises a seventh space of the second value in the third space and the fourth space, the first storage space of the second value increased comprises a third storage space of the second value in the first storage space and the second storage space, and the fifth space and the seventh space both correspond to the third storage space.

4. The method according to any one of claims 1 to 3, characterized in that, The increasing the first storage space comprises: when a difference between the size of the unused space in the second storage space and a third value is greater than or equal to a preset threshold, increasing the first storage space by a fourth value, wherein the third value is a difference between the size of the first data and the size of the unused space in the first storage space, and the fourth value is greater than or equal to the third value.

5. The method according to any one of claims 1 to 4, wherein The method further comprises: after receiving the first input of downloading the first data of the first service, displaying first prompt information when the size of the first data is greater than or equal to the size of the unused space in the first storage space, the first prompt information being used to prompt the user to start the intelligent installation function; receiving a second input of starting the intelligent installation function; The increasing the first storage space comprises: after receiving the second input, increasing the first storage space.

6. The method according to any one of claims 1 to 4, wherein The method further comprises: before receiving the first input of downloading the first data of the first service, displaying second prompt information, the second prompt information being used to prompt the user to start the intelligent installation function; receiving a third input of starting the intelligent installation function; The increasing the first storage space comprises: after receiving the third input, increasing the first storage space.

7. The method according to any one of claims 1 to 6, wherein The first chip is a chip of Trustzone architecture, and the first chip comprises a first region and a second region, wherein the first region is used to deploy and run the first service, and the second region is used to deploy and run the second service, a storage space of the first region comprises the first storage space, and a storage space of the second region comprises the second storage space.

8. The method of claim 7, wherein, The first region is a secure region, and the second region is a non-secure region; or the first region is a non-secure region, and the second region is a secure region; the working permission of the first region comprises a first user permission and a first privileged permission, the working mode of the first region comprises a first thread mode and a first processor mode, the working permission of the second region comprises a second user permission and a second privileged permission, and the working mode of the second region comprises a second thread mode and a second processor mode.

9. The method of claim 8, wherein, The first storage space is increased, and the first data is stored in the increased first storage space. The first storage space is increased in the secure region. The first data is stored in the increased first storage space in the first region, and the first region is the secure region or the non-secure region.

10. The method of claim 8 or 9, wherein, The method further comprises: The first chip is powered on and loaded; The initialization of a Trustzone architecture of the first chip is performed; The resource initialization of the secure region and the service initialization of the secure region are performed in the secure region of the first chip; The resource initialization of the non-secure region is performed in the secure region of the first chip; The service initialization of the non-secure region is performed in the non-secure region of the first chip.

11. The method of any one of claims 1-10, wherein, The first service is a near field communication (NFC) service, and the second service is an embedded subscriber identity module (eSIM) service; or the first service is an eSIM service, and the second service is an NFC service.

12. A chip system, characterized by The apparatus comprises a processing circuit and an interface circuit, the interface circuit is configured to receive code instructions and transmit the code instructions to the processing circuit, and the processing circuit is configured to run the code instructions to perform the method of any one of claims 1-11.

13. An electronic device, comprising: The apparatus comprises a transceiver, a processor and a memory, the memory is configured to store a computer program, and the processor is configured to invoke the computer program to perform the method of any one of claims 1-11.

14. An electronic device, comprising: The apparatus comprises a first chip, and the first chip is configured to perform at least one step in the method of any one of claims 1-11.

15. A computer storage medium, comprising: The computer storage medium stores a computer program, and the computer program is executed by a processor to implement the method of any one of claims 1-11.

16. A computer program product, characterised in that, The computer program product is configured to implement the method of any one of claims 1-11 when the computer program product is executed on a processor.

Citation Information

Patent Citations

  • Dynamically adjusting partition

    CN101546274A

  • Security chip, mobile communication terminal and method for improving communication security thereof

    CN106161028A

  • Method for constructing distributed storage cluster

    CN118250293A

  • Storage buffer that dynamically adjusts boundary between two storage areas when one area is full and the other has an empty data register

    US6094695A