Protecting the top-level model alone might seem adequate, yet it's considered best practice to secure each model in a set, including any parent and child reference models. This is because the Simulink.ModelReference.protect function is designed to operate on a single model at a time, securing its contents and optionally enabling code generation while keeping the model simulatable. Given your scenario with parent reference model A, which references models B and C, you should run Simulink.ModelReference.protect separately for each of the models A, B, and C. Here's how you could do it:
% Protect model A
Simulink.ModelReference.protect('A', 'Webview', true);
% Protect model B
Simulink.ModelReference.protect('B', 'Webview', false);
% Protect model C
Simulink.ModelReference.protect('C', 'Webview', false);
By protecting each model individually, you ensure that each model is secured according to your protection settings. This approach provides flexibility, allowing you to specify different protection options for each model if needed.
Remember, after protecting a model, you should add the protected version (.slxp file) of that model to the reference model block.